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 classContentAccessManager.ContentAccessEnumeration representing a content access status.
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider_currentUserProviderThe current user providerprotected ProfileAssignmentStorageExtensionPoint_profileAssignmentStorageEPThe component handling profile storageprotected RightManager_rightManagerThe right managerstatic StringROLEThe component role.
-
Constructor Summary
Constructors Constructor Description ContentAccessManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ContentAccessManager.ContentAccess_getContentAccess(Content content, UserIdentity userIdentity, boolean checkUser)ContentAccessManager.ContentAccessgetAccess(Content content)Get the access status of a content, from the user currently connected to the front-office.ContentAccessManager.ContentAccessgetAccess(Content content, boolean checkUser)Get the access status of a content, from the user currently connected to the front-office.ContentAccessManager.ContentAccessgetAccess(Content content, UserIdentity userIdentity)Get the access status of a content from a given user.ContentAccessManager.ContentAccessgetAccess(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 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:
servicein 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.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
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.ALLOWEDmay be returned).
When false, only the content general availability will be checked:ContentAccessManager.ContentAccess.ALLOWEDwill never be returned.- Returns:
- the content access status.
-
_getContentAccess
private ContentAccessManager.ContentAccess _getContentAccess(Content content, UserIdentity userIdentity, boolean checkUser)
-
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.
-
-