Package org.ametys.web.pageaccess
Class ContentAccessManager
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.web.pageaccess.ContentAccessManager
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
Class managing access to contents on the front-office side.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration representing a content access status. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected ProfileAssignmentStorageExtensionPointThe component handling profile storageprotected RightManagerThe right managerstatic final StringThe component role. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the access status of a content, from the user currently connected to the front-office.Get the access status of a content, from the user currently connected to the front-office.getAccess(Content content, UserIdentity userIdentity) Get the access status of a content from a given user.getAccess(Content content, UserIdentity userIdentity, boolean checkUser) Get the access status of a content from a given user.booleanisAccessibleByPage(WebContent content, Page currentPage) Test if the content is displayed in a page having the same access rights as the current page.voidservice(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The component role. -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_profileAssignmentStorageEP
The component handling profile storage
-
-
Constructor Details
-
ContentAccessManager
public ContentAccessManager()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getAccess
Get the access status of a content, from the user currently connected to the front-office.- Parameters:
content- the content to test.- Returns:
- the content access status.
-
getAccess
Get the access status of a content, from the user currently connected to the front-office.- Parameters:
content- the content to test.checkUser- When true, the user's ability to view the page will be checked (ContentAccessManager.ContentAccess.ALLOWEDmay be returned).
When false, only the content general availability will be checked:ContentAccessManager.ContentAccess.ALLOWEDwill never be returned.- Returns:
- the content access status.
-
getAccess
Get the access status of a content from a given user.- Parameters:
content- the content to test.userIdentity- the user identity, can be null (to test anonymous access).- Returns:
- the content access status.
-
getAccess
public ContentAccessManager.ContentAccess getAccess(Content content, UserIdentity userIdentity, boolean checkUser) Get the access status of a content from a given user. The user access is check ONLY on the content's pages. Has read access on content is not enough !- Parameters:
content- the content to test.userIdentity- the user identity, can be null (to test anonymous access).checkUser- When true, the user's ability to view the page will be checked (ContentAccessManager.ContentAccess.ALLOWEDmay be returned).
When false, only the content general availability will be checked:ContentAccessManager.ContentAccess.ALLOWEDwill never be returned.- Returns:
- the content access status.
-
isAccessibleByPage
Test if the content is displayed in a page having the same access rights as the current page.- Parameters:
content- the web content.currentPage- the current page.- Returns:
- true if the content is accessible, false otherwise.
-