02-09-2014 08:33 PM
public void removeWritePermissionFromFile(NodeRef fileNodeRef) {
System.out.println("All set permissions: " + permissionService.getAllSetPermissions(fileNodeRef));
System.out.println("Current file permissions: " + permissionService.getPermissions(fileNodeRef));
System.out.println("hasWritePermission: " + permissionService.hasPermission(fileNodeRef, permissionService.WRITE));
System.out.println("hasConsumerPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.CONSUMER));
System.out.println("hasContributorPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.CONTRIBUTOR));
System.out.println("hasCoordinatorPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.COORDINATOR));
permissionService.setInheritParentPermissions(fileNodeRef, false);
System.out.println("INHERITANCE BROKEN.");
permissionService.setPermission(fileNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.WRITE, false);
permissionService.setPermission(fileNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONTRIBUTOR, false);
permissionService.setPermission(fileNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.COORDINATOR, false);
permissionService.setPermission(fileNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
System.out.println("NEW All set permissions: " + permissionService.getAllSetPermissions(fileNodeRef));
System.out.println("NEW file permissions: " + permissionService.getPermissions(fileNodeRef));
System.out.println("NEW hasWritePermission: " + permissionService.hasPermission(fileNodeRef, permissionService.WRITE));
System.out.println("NEW hasConsumerPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.CONSUMER));
System.out.println("NEW hasContributorPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.CONTRIBUTOR));
System.out.println("NEW hasCoordinatorPermission: " + permissionService.hasPermission(fileNodeRef, permissionService.COORDINATOR));
}
All set permissions: [ALLOWED Read - GROUP_EVERYONE (EVERYONE), ALLOWED Read - bob (USER)]
Current file permissions: [ALLOWED Contributor - bob (USER), ALLOWED Consumer - bob (USER), ALLOWED Editor - bob (USER), ALLOWED Collaborator - bob (USER), ALLOWED Coordinator - bob (USER), ALLOWED All_Users - bob (USER)]
hasWritePermission: ALLOWED
hasConsumerPermission: ALLOWED
hasContributorPermission: ALLOWED
hasCoordinatorPermission: ALLOWED
INHERITANCE BROKEN.
NEW All set permissions: [ALLOWED Read - GROUP_EVERYONE (EVERYONE), ALLOWED Consumer - GROUP_EVERYONE (EVERYONE), ALLOWED Read - bob (USER), DENIED Contributor - GROUP_EVERYONE (EVERYONE), DENIED Write - GROUP_EVERYONE (EVERYONE), DENIED Coordinator - GROUP_EVERYONE (EVERYONE)]
NEW file permissions: [ALLOWED Contributor - admin (USER), ALLOWED Consumer - admin (USER), ALLOWED Editor - admin (USER), ALLOWED Collaborator - admin (USER), ALLOWED Coordinator - admin (USER), ALLOWED All_Users - admin (USER)]
NEW hasWritePermission: ALLOWED
NEW hasConsumerPermission: ALLOWED
NEW hasContributorPermission: ALLOWED
NEW hasCoordinatorPermission: ALLOWED
….
permissionService.setPermission(fileNodeRef, "GROUP_site_site1", PermissionService.WRITE, false);
….
02-10-2014 02:03 AM
02-10-2014 03:36 AM
02-10-2014 03:49 AM
02-10-2014 08:51 AM
02-10-2014 09:36 AM
…
<!– <globalPermission permission="FullControl" authority="ROLE_OWNER"/> –>
<globalPermission permission="Read" authority="ROLE_OWNER"/>
…
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.