|
@@ -109,6 +109,18 @@ func (g *Gateway) injectShareFunctions(vm *otto.Otto, u *user.User) {
|
|
return r
|
|
return r
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+ vm.Set("_share_checkSharePermission", func(call otto.FunctionCall) otto.Value {
|
|
|
|
+ shareUUID, err := call.Argument(0).ToString()
|
|
|
|
+ if err != nil {
|
|
|
|
+ return otto.New().MakeCustomError("Failed to check share permission", "No share UUID given")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ shareObject := g.Option.ShareManager.GetShareObjectFromUUID(shareUUID)
|
|
|
|
+
|
|
|
|
+ r, _ := otto.ToValue(shareObject.Accessibles)
|
|
|
|
+ return r
|
|
|
|
+ })
|
|
|
|
+
|
|
vm.Set("_share_fileIsShared", func(call otto.FunctionCall) otto.Value {
|
|
vm.Set("_share_fileIsShared", func(call otto.FunctionCall) otto.Value {
|
|
vpath, err := call.Argument(0).ToString()
|
|
vpath, err := call.Argument(0).ToString()
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -133,5 +145,6 @@ func (g *Gateway) injectShareFunctions(vm *otto.Otto, u *user.User) {
|
|
share.checkShareExists = _share_checkShareExists;
|
|
share.checkShareExists = _share_checkShareExists;
|
|
share.fileIsShared = _share_fileIsShared;
|
|
share.fileIsShared = _share_fileIsShared;
|
|
share.getFileShareUUID = _share_getShareUUID;
|
|
share.getFileShareUUID = _share_getShareUUID;
|
|
|
|
+ share.checkSharePermission = _share_checkSharePermission;
|
|
`)
|
|
`)
|
|
}
|
|
}
|