Class PrincipalHelper
- java.lang.Object
-
- org.nuxeo.ecm.automation.features.PrincipalHelper
-
public class PrincipalHelper extends Object
Provides helper methods to find extract permissions/principals info from documents.- Author:
- Bogdan Stefanescu, Anahide Tchertchian
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PrincipalHelper.EmailCollector
-
Field Summary
Fields Modifier and Type Field Description protected PermissionProvider
permissionProvider
protected UserManager
userManager
-
Constructor Summary
Constructors Constructor Description PrincipalHelper(UserManager userManager, PermissionProvider permissionProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
collectObjectsFromGroup(String groupId, boolean resolveGroups, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
HashSet<?>
collectObjectsMatchingPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
Set<String>
getEmailsForPermission(DocumentModel input, String permission, boolean ignoreGroups)
Set<String>
getEmailsFromGroup(String groupId, boolean resolveGroups)
String[]
getPermissionsToCheck(String permission)
Set<NuxeoPrincipal>
getPrincipalsForPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups)
Set<NuxeoPrincipal>
getPrincipalsFromGroup(String groupId, boolean resolveGroups)
Set<String>
getUserAndGroupIdsForPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups, boolean prefixIds)
Resolves the list of identifiers for users and groups who have the given permission on given document.Set<String>
getUserNamesFromGroup(String groupId, boolean resolveGroups, boolean prefixIds)
boolean
permissionMatch(String[] perms, String perm)
void
resolveGroups(NuxeoGroup group, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
-
-
-
Field Detail
-
userManager
protected UserManager userManager
-
permissionProvider
protected PermissionProvider permissionProvider
-
-
Constructor Detail
-
PrincipalHelper
public PrincipalHelper(UserManager userManager, PermissionProvider permissionProvider)
-
-
Method Detail
-
getEmailsForPermission
public Set<String> getEmailsForPermission(DocumentModel input, String permission, boolean ignoreGroups)
-
getUserAndGroupIdsForPermission
public Set<String> getUserAndGroupIdsForPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups, boolean prefixIds)
Resolves the list of identifiers for users and groups who have the given permission on given document.- Parameters:
input
- document model to resolve users and groups on.permission
- the permission to checkignoreGroups
- if true, will ignore groups in resolution of idsresolveGroups
- if true, will resolve user members, iterating in the hierarchy of groupsprefixIds
- if true, will prefix identifiers withNuxeoPrincipal.PREFIX
andNuxeoGroup.PREFIX
-
getPrincipalsForPermission
public Set<NuxeoPrincipal> getPrincipalsForPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups)
-
getPrincipalsFromGroup
public Set<NuxeoPrincipal> getPrincipalsFromGroup(String groupId, boolean resolveGroups)
-
getUserNamesFromGroup
public Set<String> getUserNamesFromGroup(String groupId, boolean resolveGroups, boolean prefixIds)
-
collectObjectsFromGroup
public void collectObjectsFromGroup(String groupId, boolean resolveGroups, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
-
collectObjectsMatchingPermission
public HashSet<?> collectObjectsMatchingPermission(DocumentModel input, String permission, boolean ignoreGroups, boolean resolveGroups, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
-
resolveGroups
public void resolveGroups(NuxeoGroup group, org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
-
-