Package org.ametys.odf.rights
Class ODFRightHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.odf.rights.ODFRightHelper
- All Implemented Interfaces:
- LogEnabled,- Initializable,- Component,- Contextualizable,- Serviceable
- Direct Known Subclasses:
- ODFRightHelper
public class ODFRightHelper
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable, Initializable
Helper for ODF right
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classClass representing the permission context for parents computation.classExpression for ODF role expression
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected AbstractCacheManagerThe cache managerprotected ContextThe avalon contextprotected ODFHelperThe ODF helperprotected AmetysObjectResolverAmetys Object Resolverstatic final StringAttribute path for contributor rolestatic final StringAttribute path for manager rolestatic final StringThe avalon role
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncomputeOrgUnits(ProgramItem programItem, ODFRightHelper.PermissionContext permissionCtx) Get the orgunits of a program itemprotected List<ProgramItem>computeParentProgramItem(Course course, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a course from a rights perspectiveprotected List<ProgramItem>computeParentProgramItem(ProgramItem programItem, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a program item from a rights perspectiveprotected Set<AmetysObject>computeParents(Content content, ODFRightHelper.PermissionContext permissionCtx) Compute the parents of a ODF content from a rights perspectivevoidcontextualize(Context context) Get the id of profile for contributorsgetContributors(Content content) Get the contributors of aProgramItemor aOrgUnitgetContributorsQuery(UserIdentity... users) Build a user query on contributors fieldGet the id of profile for managersgetManagers(Content content) Get the managers of aProgramItemor aOrgUnitgetManagersQuery(UserIdentity... users) Build a user query on managers fieldgetParents(Content content, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a ODF content from a rights perspectivegetProgramItemsWithUserAsRole(UserIdentity user, String roleAttributePath) Get the programs items the user is set with a rolegetRolesQuery(UserIdentity user) Get the query to search for contents for which the user has a rolevoidvoidservice(ServiceManager smanager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabledgetLogger, setLogger
- 
Field Details- 
ROLEThe avalon role
- 
CONTRIBUTORS_FIELD_PATHAttribute path for contributor role- See Also:
 
- 
MANAGERS_FIELD_PATHAttribute path for manager role- See Also:
 
- 
_odfHelperThe ODF helper
- 
_contextThe avalon context
- 
_resolverAmetys Object Resolver
- 
_cacheManagerThe cache manager
 
- 
- 
Constructor Details- 
ODFRightHelperpublic ODFRightHelper()
 
- 
- 
Method Details- 
contextualize- Specified by:
- contextualizein interface- Contextualizable
- Throws:
- ContextException
 
- 
service- Specified by:
- servicein interface- Serviceable
- Throws:
- ServiceException
 
- 
initialize- Specified by:
- initializein interface- Initializable
- Throws:
- Exception
 
- 
getContributorProfileIdGet the id of profile for contributors- Returns:
- the id of profile for contributors
 
- 
getManagerProfileIdGet the id of profile for managers- Returns:
- the id of profile for managers
 
- 
getContributorsGet the contributors of aProgramItemor aOrgUnit- Parameters:
- content- the program item or the orgunit
- Returns:
- the contributors or null if not found
 
- 
getContributorsQueryBuild a user query on contributors field- Parameters:
- users- The users to test.
- Returns:
- the user query
 
- 
getManagersGet the managers of aProgramItemor aOrgUnit- Parameters:
- content- the program item or the orgunit
- Returns:
- the managers or null if not found
 
- 
getManagersQueryBuild a user query on managers field- Parameters:
- users- The users to test.
- Returns:
- the user query
 
- 
getRolesQueryGet the query to search for contents for which the user has a role- Parameters:
- user- the user
- Returns:
- the query to filter on user permission
 
- 
getProgramItemsWithUserAsRolepublic AmetysObjectIterable<ProgramItem> getProgramItemsWithUserAsRole(UserIdentity user, String roleAttributePath) Get the programs items the user is set with a role- Parameters:
- user- The user
- roleAttributePath- the attribute path for role
- Returns:
- the program items the user is set with a role
 
- 
getParentspublic Set<AmetysObject> getParents(Content content, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a ODF content from a rights perspective- Parameters:
- content- the content
- permissionCtx- The permission context to compute rights. The permission context allows to restrict parents to parents which are part of a given ancestor. See #withAncestor method of- ODFRightHelper.PermissionContext
- Returns:
- the parents of the content for rights computing
 
- 
computeParentsprotected Set<AmetysObject> computeParents(Content content, ODFRightHelper.PermissionContext permissionCtx) Compute the parents of a ODF content from a rights perspective- Parameters:
- content- the content
- permissionCtx- The permission context to compute rights.
- Returns:
- the parents of the content for rights computing
 
- 
computeParentProgramItemprotected List<ProgramItem> computeParentProgramItem(ProgramItem programItem, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a program item from a rights perspective- Parameters:
- programItem- the program item
- permissionCtx- The permission context to compute rights.
- Returns:
- the parent program items for rights computing
 
- 
computeParentProgramItemprotected List<ProgramItem> computeParentProgramItem(Course course, ODFRightHelper.PermissionContext permissionCtx) Get the parents of a course from a rights perspective- Parameters:
- course- the course
- permissionCtx- The permission context to compute rights.
- Returns:
- the course parents for rights computing
 
- 
computeOrgUnitsprotected List<OrgUnit> computeOrgUnits(ProgramItem programItem, ODFRightHelper.PermissionContext permissionCtx) Get the orgunits of a program item- Parameters:
- programItem- the program item
- permissionCtx- The permission context to compute rights.
- Returns:
- the orgunits
 
 
-