Class PrincipalHelper


  • public class PrincipalHelper
    extends Object
    Provides helper methods to find extract permissions/principals info from documents.
    Author:
    Bogdan Stefanescu, Anahide Tchertchian
    • Method Detail

      • 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 check
        ignoreGroups - if true, will ignore groups in resolution of ids
        resolveGroups - if true, will resolve user members, iterating in the hierarchy of groups
        prefixIds - if true, will prefix identifiers with NuxeoPrincipal.PREFIX and NuxeoGroup.PREFIX
      • getEmailsFromGroup

        public Set<String> getEmailsFromGroup​(String groupId,
                                              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)
      • getPermissionsToCheck

        public String[] getPermissionsToCheck​(String permission)
      • permissionMatch

        public boolean permissionMatch​(String[] perms,
                                       String perm)