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
Modifier and TypeClassDescriptionstatic enum
Enumeration representing a content access status. -
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected ProfileAssignmentStorageExtensionPoint
The component handling profile storageprotected RightManager
The right managerstatic final String
The component role. -
Constructor Summary
-
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.boolean
isAccessibleByPage
(WebContent content, Page currentPage) Test if the content is displayed in a page having the same access rights as the current page.void
service
(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:
service
in 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.ALLOWED
may be returned).
When false, only the content general availability will be checked:ContentAccessManager.ContentAccess.ALLOWED
will 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.ALLOWED
may be returned).
When false, only the content general availability will be checked:ContentAccessManager.ContentAccess.ALLOWED
will 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.
-