]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check which permissions are possible to re-share a file
authorBjoern Schiessle <schiessle@owncloud.com>
Mon, 18 Nov 2013 10:58:42 +0000 (11:58 +0100)
committerBjoern Schiessle <schiessle@owncloud.com>
Mon, 18 Nov 2013 10:58:42 +0000 (11:58 +0100)
core/js/share.js

index 411f0d23c36bd7987f2c9c051eefc9a0191f0de8..e2911ae2ff3f611d4ebdf87647063322e1f4f4be 100644 (file)
@@ -190,6 +190,7 @@ OC.Share={
                        }
                        html += '<br />';
                }
+
                if (possiblePermissions & OC.PERMISSION_SHARE) {
                        // Determine the Allow Public Upload status.
                        // Used later on to determine if the
@@ -292,7 +293,21 @@ OC.Share={
                                var shareWith = selected.item.value.shareWith;
                                $(this).val(shareWith);
                                // Default permissions are Edit (CRUD) and Share
-                               var permissions = OC.PERMISSION_ALL;
+                               // Check if these permissions are possible
+                               var permissions = OC.PERMISSION_READ;
+                               if (possiblePermissions & OC.PERMISSION_UPDATE) {
+                                       permissions = permissions | OC.PERMISSION_UPDATE;
+                               }
+                               if (possiblePermissions & OC.PERMISSION_CREATE) {
+                                       permissions = permissions | OC.PERMISSION_CREATE;
+                               }
+                               if (possiblePermissions & OC.PERMISSION_DELETE) {
+                                       permissions = permissions | OC.PERMISSION_DELETE;
+                               }
+                               if (possiblePermissions & OC.PERMISSION_SHARE) {
+                                       permissions = permissions | OC.PERMISSION_SHARE;
+                               }
+
                                OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, function() {
                                        OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions);
                                        $('#shareWith').val('');