public interface HierarchyPermissions
| Modifier and Type | Method and Description |
|---|---|
void |
assignUserNodePerm(String userId,
String nodeId,
String hierarchyPermission,
boolean cascade)
Assign the given permission to a user for the given hierarchy node,
can cascade the permission downward if desired
|
boolean |
checkUserNodePerm(String userId,
String nodeId,
String hierarchyPermission)
Determine if a user has a specific hierarchy permission at a specific hierarchy node,
a permission key can be any string though it will most likely be from a relatively small set
|
Map<String,Map<String,Set<String>>> |
getNodesAndPermsForUser(String... userIds)
Get all the nodeIds and permissions for the given userIds,
the returned map will always contain every userId that was passed in as a key
|
Set<HierarchyNode> |
getNodesForUserPerm(String userId,
String hierarchyPermission)
Get the hierarchy nodes which a user has a specific permission in,
this is used to find a set of nodes which a user should be able to see and to build
the list of hierarchy nodes a user has a given permission in
|
Set<String> |
getPermsForUserNodes(String userId,
String[] nodeIds)
Get the set of all permissions which a user has on a node or group of nodes,
NOTE: this will get the set of ALL permissions inclusively for the given nodeIds
so nodes in the set which a user has no permissions on will not cause this to return no permissions,
example: for given user: nodeA(perm1, perm2), nodeB(perm1), nodeC(perm2), nodeD() : returns: (perm1, perm2)
|
Set<String> |
getUserIdsForNodesPerm(String[] nodeIds,
String hierarchyPermission)
Get all the userIds for users which have a specific permission in a set of
hierarchy nodes, this can be used to check one node or many nodes as needed
|
Map<String,Map<String,Set<String>>> |
getUsersAndPermsForNodes(String... nodeIds)
Get all the users and permissions currently assigned to nodes,
the returned map will always contain every passed in nodeId as a key
This is not super efficient by itself so it should not used when other methods are sufficient, however, it is actually much better than calling the other methods repeatedly so this is primarily for use in administrative interfaces |
void |
removeUserNodePerm(String userId,
String nodeId,
String hierarchyPermission,
boolean cascade)
Remove a permission for a user from the given hierarchy node,
can cascade the permission downward if desired
|
boolean checkUserNodePerm(String userId, String nodeId, String hierarchyPermission)
userId - the internal user id (not username)nodeId - a unique id for a hierarchy nodehierarchyPermission - a string which indicates a permission key (e.g. delete.item)void assignUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade)
userId - the internal user id (not username)nodeId - a unique id for a hierarchy nodehierarchyPermission - a string which indicates a permission key (e.g. delete.item)cascade - if true then the permission is assigned to all nodes below this one as well,
if false it is only assigned to this nodevoid removeUserNodePerm(String userId, String nodeId, String hierarchyPermission, boolean cascade)
userId - the internal user id (not username)nodeId - a unique id for a hierarchy nodehierarchyPermission - a string which indicates a permission key (e.g. delete.item)cascade - if true then the permission is removed from all nodes below this one as well,
if false it is only removed from this nodeSet<String> getUserIdsForNodesPerm(String[] nodeIds, String hierarchyPermission)
nodeIds - an array of unique ids for hierarchy nodeshierarchyPermission - a string which indicates a permission key (e.g. delete.item)Set<HierarchyNode> getNodesForUserPerm(String userId, String hierarchyPermission)
userId - the internal user id (not username)hierarchyPermission - a string which indicates a permission key (e.g. delete.item)HierarchyNode objectsSet<String> getPermsForUserNodes(String userId, String[] nodeIds)
userId - the internal user id (not username)nodeIds - an array of unique ids for hierarchy nodesMap<String,Map<String,Set<String>>> getUsersAndPermsForNodes(String... nodeIds)
nodeIds - an array of unique ids for hierarchy nodesMap<String,Map<String,Set<String>>> getNodesAndPermsForUser(String... userIds)
userIds - an array of unique ids for users (internal id, not eid)Copyright © 2003–2021 Sakai Project. All rights reserved.