Skip to content

Commit

Permalink
COLORADO-1203 Added in permission settings for adding streams to an o…
Browse files Browse the repository at this point in the history
…bject

The "Add" button functionality is not availble to users that have
'add fedora datastreams' permissions set on their Drupal accounts.  The changes
made disable the "Add" button and do not install a click handler unless this
permission is set for the user.
  • Loading branch information
discoverygnoye committed Nov 15, 2011
1 parent 3835324 commit decc85c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ADRCollection.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ADRCollection {
$canEditObjects = user_access("edit fedora meta data");
$canEditPermissions = user_access("Edit XACML Policies");
$canEditChildPermissions = user_access("Edit XACML Policies");
$canAddStream = user_access("add fedora datastreams");
$canDeleteObject = user_access("purge objects and datastreams");
$canDeleteStream = user_access("purge objects and datastreams");
$canEditStream = user_access("edit fedora meta data");
Expand All @@ -109,6 +110,7 @@ class ADRCollection {
"UserCollectionPermissions.manage_canEditPermissions=" . ($canEditPermissions ? "true" : "false") . ";" .
"UserCollectionPermissions.manage_canEditChildPermissions=" . ($canEditChildPermissions ? "true" : "false") . ";" .
"UserCollectionPermissions.manage_canDeleteObject=" . ($canDeleteObject ? "true" : "false") . ";" .
"UserCollectionPermissions.datastream_canAddStream=" . ($canAddStream ? "true" : "false") . ";" .
"UserCollectionPermissions.datastream_canEditStream=" . ($canEditStream ? "true" : "false") . ";" .
"UserCollectionPermissions.datastream_canDeleteStream=" . ($canDeleteStream ? "true" : "false") . ";";
drupal_add_js($permissions_block, 'inline');
Expand Down
10 changes: 7 additions & 3 deletions js/Manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,20 @@ Manage = Ext.extend(ManageUi, {
}]
});

add.disable();
edit.disable();
remove.disable();

details.updateDetails = function(record) {
this.tpl.overwrite(this.body, record.data);
}

add.addListener('click', function(button, event) {
gotoFilesIngestPage(ADRCollection.pid);
});
if (UserCollectionPermissions.datastream_canAddStream) {
add.enable();
add.addListener('click', function(button, event) {
gotoFilesIngestPage(ADRCollection.pid);
});
}

download.addListener('click', function(button, event) {
var records = viewer.getSelectedRecords();
Expand Down

0 comments on commit decc85c

Please sign in to comment.