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
Unlock or lock one or several content(s)
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentHelper
The content helperprotected CurrentUserProvider
The current user provider.protected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The rights managerprotected UserHelper
Helper for usersstatic final String
The component role.static final String
The "unlock all" right ID. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.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.boolean
Test if the current user has the right to unlock all contents.boolean
canUnlockAll
(UserIdentity user) Test if a specific user has the right to unlock all contents.Lock contentsvoid
service
(ServiceManager smanager) Unlock contentsunlockOrLock
(List<String> contents, String mode) Unlock or lock contentsMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The component role. -
UNLOCK_ALL_RIGHT
The "unlock all" right ID.- See Also:
-
_rightManager
The rights manager -
_resolver
The Ametys object resolver -
_currentUserProvider
The current user provider. -
_userHelper
Helper for users -
_contentHelper
The content helper
-
-
Constructor Details
-
LockContentManager
public LockContentManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
canUnlock
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
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
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
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
Unlock or lock contents- Parameters:
contents
- the contents to unlock or lockmode
- the mode ('lock' or 'unlock')- Returns:
- the result JSON map
-
unlock
Unlock contents- Parameters:
contents
- The ids of contents to unlock- Returns:
- the result JSON map
-
lock
Lock contents- Parameters:
contents
- The ids of contents to lock- Returns:
- the result JSON map
-