Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.automation.features
Class PrincipalHelper

java.lang.Object
  extended by 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
static class PrincipalHelper.EmailCollector
           
 
Constructor Summary
PrincipalHelper(UserManager userManager, PermissionProvider permissionProvider)
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrincipalHelper

public PrincipalHelper(UserManager userManager,
                       PermissionProvider permissionProvider)
Method Detail

getEmailsForPermission

public Set<String> getEmailsForPermission(DocumentModel input,
                                          String permission,
                                          boolean ignoreGroups)
                                   throws ClientException
Throws:
ClientException

getUserAndGroupIdsForPermission

public Set<String> getUserAndGroupIdsForPermission(DocumentModel input,
                                                   String permission,
                                                   boolean ignoreGroups,
                                                   boolean resolveGroups,
                                                   boolean prefixIds)
                                            throws ClientException
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
Throws:
ClientException

getPrincipalsForPermission

public Set<NuxeoPrincipal> getPrincipalsForPermission(DocumentModel input,
                                                      String permission,
                                                      boolean ignoreGroups,
                                                      boolean resolveGroups)
                                               throws ClientException
Throws:
ClientException

getEmailsFromGroup

public Set<String> getEmailsFromGroup(String groupId,
                                      boolean resolveGroups)
                               throws ClientException
Throws:
ClientException

getPrincipalsFromGroup

public Set<NuxeoPrincipal> getPrincipalsFromGroup(String groupId,
                                                  boolean resolveGroups)
                                           throws ClientException
Throws:
ClientException

getUserNamesFromGroup

public Set<String> getUserNamesFromGroup(String groupId,
                                         boolean resolveGroups,
                                         boolean prefixIds)
                                  throws ClientException
Throws:
ClientException

collectObjectsFromGroup

public void collectObjectsFromGroup(String groupId,
                                    boolean resolveGroups,
                                    org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
                             throws ClientException
Throws:
ClientException

collectObjectsMatchingPermission

public HashSet<?> collectObjectsMatchingPermission(DocumentModel input,
                                                   String permission,
                                                   boolean ignoreGroups,
                                                   boolean resolveGroups,
                                                   org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
                                            throws ClientException
Throws:
ClientException

resolveGroups

public void resolveGroups(NuxeoGroup group,
                          org.nuxeo.ecm.automation.features.PrincipalHelper.Collector<?> collector)
                   throws ClientException
Throws:
ClientException

getPermissionsToCheck

public String[] getPermissionsToCheck(String permission)

permissionMatch

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

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.