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
public class ContentAccessManager extends AbstractLogEnabled implements Component, Serviceable
Class managing access to contents on the front-office side.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ContentAccessManager.ContentAccess
Enumeration representing a content access status.
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected ProfileAssignmentStorageExtensionPoint
_profileAssignmentStorageEP
The component handling profile storageprotected RightManager
_rightManager
The right managerstatic String
ROLE
The component role.
-
Constructor Summary
Constructors Constructor Description ContentAccessManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentAccessManager.ContentAccess
getAccess(Content content)
Get the access status of a content, from the user currently connected to the front-office.ContentAccessManager.ContentAccess
getAccess(Content content, boolean checkUser)
Get the access status of a content, from the user currently connected to the front-office.ContentAccessManager.ContentAccess
getAccess(Content content, UserIdentity userIdentity)
Get the access status of a content from a given user.ContentAccessManager.ContentAccess
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 Detail
-
_rightManager
protected RightManager _rightManager
The right manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_profileAssignmentStorageEP
protected ProfileAssignmentStorageExtensionPoint _profileAssignmentStorageEP
The component handling profile storage
-
-
Constructor Detail
-
ContentAccessManager
public ContentAccessManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getAccess
public ContentAccessManager.ContentAccess getAccess(Content content)
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
public ContentAccessManager.ContentAccess getAccess(Content content, boolean checkUser)
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
public ContentAccessManager.ContentAccess getAccess(Content content, UserIdentity userIdentity)
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
public boolean isAccessibleByPage(WebContent content, Page currentPage)
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.
-
-