use of org.jbei.ice.lib.entry.EntryPermissionTask in project ice by JBEI.
the class PermissionsController method propagateFolderPermissions.
/**
* Propagates the permissions for the folder to the contained entries
*
* @param userId unique identifier for account of user requesting action that led to this call
* @param folder folder user permissions are being propagated
* @param add true if folder is to be added, false otherwise
* @return true if action permission was scheduled to be propagated
*/
public boolean propagateFolderPermissions(String userId, Folder folder, boolean add) {
if (!accountController.isAdministrator(userId) && !userId.equalsIgnoreCase(folder.getOwnerEmail()))
return false;
// retrieve folder permissions
List<AccessPermission> permissions = retrieveSetFolderPermission(folder, true);
if (permissions.isEmpty())
return true;
List<Long> entries = folderDAO.getEntryIds(folder);
EntryPermissionTask task = new EntryPermissionTask(userId, entries, permissions, add);
IceExecutorService.getInstance().runTask(task);
return true;
}
Aggregations