Package org.ametys.cms.lock
Class LockContentManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.cms.lock.LockContentManager
-
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
public class LockContentManager extends AbstractLogEnabled implements Serviceable, Component
Unlock or lock one or several content(s)
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper_contentHelperThe content helperprotected CurrentUserProvider_currentUserProviderThe current user provider.protected AmetysObjectResolver_resolverThe Ametys object resolverprotected RightManager_rightManagerThe rights managerstatic StringROLEThe component role.static StringUNLOCK_ALL_RIGHTThe "unlock all" right ID.
-
Constructor Summary
Constructors Constructor Description LockContentManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanUnlock(LockAwareAmetysObject object)Test if the current user can unlock the given locked object.
A user can unlock a locked object if he is the lock owner, or if he has the right to unlock all objects.booleancanUnlock(LockAwareAmetysObject object, UserIdentity user)Test if a specific user can unlock the given locked object.
A user can unlock a locked object if he is the lock owner, or if he has the right to unlock all objects.booleancanUnlockAll()Test if the current user has the right to unlock all contents.booleancanUnlockAll(UserIdentity user)Test if a specific user has the right to unlock all contents.protected Map<String,Object>lock(List<String> contents)Lock contentsvoidservice(ServiceManager smanager)protected Map<String,Object>unlock(List<String> contents)Unlock contentsMap<String,Object>unlockOrLock(List<String> contents, String mode)Unlock or lock contents-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
UNLOCK_ALL_RIGHT
public static final String UNLOCK_ALL_RIGHT
The "unlock all" right ID.- See Also:
- Constant Field Values
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
-
Constructor Detail
-
LockContentManager
public LockContentManager()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
canUnlock
public boolean canUnlock(LockAwareAmetysObject object)
Test if the current user can unlock the given locked object.
A user can unlock a locked object if he is the lock owner, or if he has the right to unlock all objects.- Parameters:
object- the locked object to test.- Returns:
- true if the current user can unlock the given locked object, false otherwise.
-
canUnlock
public boolean canUnlock(LockAwareAmetysObject object, UserIdentity user)
Test if a specific user can unlock the given locked object.
A user can unlock a locked object if he is the lock owner, or if he has the right to unlock all objects.- Parameters:
object- the locked object to test.user- the user.- Returns:
- true if the current user can unlock the given locked object, false otherwise.
-
canUnlockAll
public boolean canUnlockAll()
Test if the current user has the right to unlock all contents.- Returns:
- true if the current user has the right to unlock all contents, false otherwise.
-
canUnlockAll
public boolean canUnlockAll(UserIdentity user)
Test if a specific user has the right to unlock all contents.- Parameters:
user- the user.- Returns:
- true if the user has the right to unlock all contents, false otherwise.
-
unlockOrLock
public Map<String,Object> unlockOrLock(List<String> contents, String mode)
Unlock or lock contents- Parameters:
contents- the contents to unlock or lockmode- the mode ('lock' or 'unlock')- Returns:
- the result JSON map
-
unlock
protected Map<String,Object> unlock(List<String> contents)
Unlock contents- Parameters:
contents- The ids of contents to unlock- Returns:
- the result JSON map
-
-