]> source.dussan.org Git - nextcloud-server.git/commitdiff
unify permissions (2/3): change apps to use OC::PERMISSION_X
authorJörn Friedrich Dreyer <jfd@butonic.de>
Thu, 30 Aug 2012 23:05:36 +0000 (01:05 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Thu, 30 Aug 2012 23:11:10 +0000 (01:11 +0200)
apps/files/js/fileactions.js
apps/files_sharing/js/public.js
apps/files_sharing/js/share.js
apps/files_versions/js/versions.js
core/js/share.js

index 89e7bdd7ad744987ce5e9e2840a9b6ff53df2969..f587e99f9668749674a8d4fb6150c35bf36b7439 100644 (file)
@@ -156,12 +156,12 @@ $(document).ready(function(){
        } else {
                var downloadScope = 'file';
        }
-       FileActions.register(downloadScope,'Download', FileActions.PERMISSION_READ, function(){return OC.imagePath('core','actions/download')},function(filename){
+       FileActions.register(downloadScope,'Download', OC.PERMISSION_READ, function(){return OC.imagePath('core','actions/download')},function(filename){
                window.location=OC.filePath('files', 'ajax', 'download.php') + encodeURIComponent('?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()));
        });
 });
 
-FileActions.register('all','Delete', FileActions.PERMISSION_DELETE, function(){return OC.imagePath('core','actions/delete')},function(filename){
+FileActions.register('all','Delete', OC.PERMISSION_DELETE, function(){return OC.imagePath('core','actions/delete')},function(filename){
        if(Files.cancelUpload(filename)) {
                if(filename.substr){
                        filename=[filename];
@@ -179,11 +179,11 @@ FileActions.register('all','Delete', FileActions.PERMISSION_DELETE, function(){r
        $('.tipsy').remove();
 });
 
-FileActions.register('all','Rename', FileActions.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/rename')},function(filename){
+FileActions.register('all','Rename', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/rename')},function(filename){
        FileList.rename(filename);
 });
 
-FileActions.register('dir','Open', FileActions.PERMISSION_READ, '', function(filename){
+FileActions.register('dir','Open', OC.PERMISSION_READ, '', function(filename){
        window.location=OC.linkTo('files', 'index.php') + '&dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename);
 });
 
index 1ab61d476ecf0d50360f13ff0c76483ae641cdcb..92b626bba18510c5dce916dbd6119d838efdb8b7 100644 (file)
@@ -10,7 +10,7 @@ $(document).ready(function() {
                // Show file preview if previewer is available, images are already handled by the template
                if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') {
                        // Trigger default action if not download TODO
-                       var action = FileActions.getDefault(mimetype, 'file', FileActions.PERMISSION_READ);
+                       var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ);
                        if (typeof action === 'undefined') {
                                $('#noPreview').show();
                        } else {
index 79ab4adebac392f1a6908c156c7def71d318eed3..a171751589ae29f648dc7450e9142ad26ac891ff 100644 (file)
@@ -2,7 +2,7 @@ $(document).ready(function() {
 
        if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined') {
                OC.Share.loadIcons('file');
-               FileActions.register('all', 'Share', FileActions.PERMISSION_READ, function(filename) {
+               FileActions.register('all', 'Share', OC.PERMISSION_READ, function(filename) {
                        // Return the correct sharing icon
                        if (scanFiles.scanning) { return; } // workaround to prevent additional http request block scanning feedback
                        if ($('#dir').val() == '/') {
index e34a6f50cacc899d83b029d7e3d7491962472b0a..a9cf6171e455726ee482a26e705f275156b94f21 100644 (file)
@@ -11,7 +11,7 @@ $(document).ready(function() {
 $(document).ready(function(){
        if (typeof FileActions !== 'undefined') {
                // Add history button to files/index.php
-               FileActions.register('file','History', FileActions.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history')},function(filename){
+               FileActions.register('file','History', OC.PERMISSION_UPDATE, function(){return OC.imagePath('core','actions/history')},function(filename){
 
                        if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
 
index 8bfbdd36e197106a44f37432656cf134847927f3..f8ff6907329ae04b60460f790014492b8123aa43 100644 (file)
@@ -129,7 +129,7 @@ OC.Share={
                        }
                        html += '<br />';
                }
-               if (possiblePermissions & OC.Share.PERMISSION_SHARE) {
+               if (possiblePermissions & OC.PERMISSION_SHARE) {
                        html += '<input id="shareWith" type="text" placeholder="Share with" />';
                        html += '<ul id="shareWithList">';
                        html += '</ul>';
@@ -187,7 +187,7 @@ OC.Share={
                                var shareWith = selected.item.value.shareWith;
                                $(this).val(shareWith);
                                // Default permissions are Read and Share
-                               var permissions = OC.Share.PERMISSION_READ | OC.Share.PERMISSION_SHARE;
+                               var permissions = OC.PERMISSION_READ | OC.PERMISSION_SHARE;
                                OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() {
                                        OC.Share.addShareWith(shareType, shareWith, permissions, possiblePermissions);
                                        $('#shareWith').val('');
@@ -224,24 +224,24 @@ OC.Share={
                }
                OC.Share.itemShares[shareType].push(shareWith);
                var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = '';
-               if (permissions & OC.Share.PERMISSION_CREATE) {
+               if (permissions & OC.PERMISSION_CREATE) {
                        createChecked = 'checked="checked"';
                        editChecked = 'checked="checked"';
                }
-               if (permissions & OC.Share.PERMISSION_UPDATE) {
+               if (permissions & OC.PERMISSION_UPDATE) {
                        updateChecked = 'checked="checked"';
                        editChecked = 'checked="checked"';
                }
-               if (permissions & OC.Share.PERMISSION_DELETE) {
+               if (permissions & OC.PERMISSION_DELETE) {
                        deleteChecked = 'checked="checked"';
                        editChecked = 'checked="checked"';
                }
-               if (permissions & OC.Share.PERMISSION_SHARE) {
+               if (permissions & OC.PERMISSION_SHARE) {
                        shareChecked = 'checked="checked"';
                }
                var html = '<li style="clear: both;" data-share-type="'+shareType+'" data-share-with="'+shareWith+'">';
                html += shareWith;
-               if (possiblePermissions & OC.Share.PERMISSION_CREATE || possiblePermissions & OC.Share.PERMISSION_UPDATE || possiblePermissions & OC.Share.PERMISSION_DELETE) {
+               if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) {
                        if (editChecked == '') {
                                html += '<label style="display:none;">';
                        } else {
@@ -252,17 +252,17 @@ OC.Share={
                html += '<a href="#" class="showCruds" style="display:none;"><img class="svg" alt="Unshare" src="'+OC.imagePath('core', 'actions/triangle-s')+'"/></a>';
                html += '<a href="#" class="unshare" style="display:none;"><img class="svg" alt="Unshare" src="'+OC.imagePath('core', 'actions/delete')+'"/></a>';
                html += '<div class="cruds" style="display:none;">';
-                       if (possiblePermissions & OC.Share.PERMISSION_CREATE) {
-                               html += '<label><input type="checkbox" name="create" class="permissions" '+createChecked+' data-permissions="'+OC.Share.PERMISSION_CREATE+'" />create</label>';
+                       if (possiblePermissions & OC.PERMISSION_CREATE) {
+                               html += '<label><input type="checkbox" name="create" class="permissions" '+createChecked+' data-permissions="'+OC.PERMISSION_CREATE+'" />create</label>';
                        }
-                       if (possiblePermissions & OC.Share.PERMISSION_UPDATE) {
-                               html += '<label><input type="checkbox" name="update" class="permissions" '+updateChecked+' data-permissions="'+OC.Share.PERMISSION_UPDATE+'" />update</label>';
+                       if (possiblePermissions & OC.PERMISSION_UPDATE) {
+                               html += '<label><input type="checkbox" name="update" class="permissions" '+updateChecked+' data-permissions="'+OC.PERMISSION_UPDATE+'" />update</label>';
                        }
-                       if (possiblePermissions & OC.Share.PERMISSION_DELETE) {
-                               html += '<label><input type="checkbox" name="delete" class="permissions" '+deleteChecked+' data-permissions="'+OC.Share.PERMISSION_DELETE+'" />delete</label>';
+                       if (possiblePermissions & OC.PERMISSION_DELETE) {
+                               html += '<label><input type="checkbox" name="delete" class="permissions" '+deleteChecked+' data-permissions="'+OC.PERMISSION_DELETE+'" />delete</label>';
                        }
-                       if (possiblePermissions & OC.Share.PERMISSION_SHARE) {
-                               html += '<label><input type="checkbox" name="share" class="permissions" '+shareChecked+' data-permissions="'+OC.Share.PERMISSION_SHARE+'" />share</label>';
+                       if (possiblePermissions & OC.PERMISSION_SHARE) {
+                               html += '<label><input type="checkbox" name="share" class="permissions" '+shareChecked+' data-permissions="'+OC.PERMISSION_SHARE+'" />share</label>';
                        }
                html += '</div>';
                html += '</li>';
@@ -386,7 +386,7 @@ $(document).ready(function() {
                                $(checkboxes).filter('input[name="edit"]').attr('checked', true);
                        }
                }
-               var permissions = OC.Share.PERMISSION_READ;
+               var permissions = OC.PERMISSION_READ;
                $(checkboxes).filter(':not(input[name="edit"])').filter(':checked').each(function(index, checkbox) {
                        permissions |= $(checkbox).data('permissions');
                });
@@ -398,7 +398,7 @@ $(document).ready(function() {
                var itemSource = $('#dropdown').data('item-source');
                if (this.checked) {
                        // Create a link
-                       OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.Share.PERMISSION_READ, function() {
+                       OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, function() {
                                OC.Share.showLink(itemSource);
                                // TODO Change icon
                        });
@@ -423,7 +423,7 @@ $(document).ready(function() {
                if (event.keyCode == 13) {
                        var itemType = $('#dropdown').data('item-type');
                        var itemSource = $('#dropdown').data('item-source');
-                       OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.Share.PERMISSION_READ, function() {
+                       OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, $(this).val(), OC.PERMISSION_READ, function() {
                                $('#linkPassText').val('');
                                $('#linkPassText').attr('placeholder', 'Password protected');
                        });