Class ContentPermission
java.lang.Object
com.atlassian.core.bean.EntityObject
com.atlassian.confluence.core.ConfluenceEntityObject
com.atlassian.confluence.security.ContentPermission
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<ContentPermission>
- Direct Known Subclasses:
NeverPermittedContentPermission
public class ContentPermission
extends ConfluenceEntityObject
implements Comparable<ContentPermission>
Allows a user to lock content against editing and/or viewing by other users.
This is a DB-level entity (see
com/atlassian/confluence/security/ContentPermission.hbm.xml
).
Directly corresponding equivalent for ServiceLayer would be ContentRestriction
Each Content has as many ContentPermissionSet
s linked as there are operations restricted for the content.
Each ContentPermissionSet
has as many ContentPermission
s as there are specific users and/or groups to whom corresponding operations are restricted.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionThis has to be public because theReflectiveObjectPersister
requires public default constructors.Copy constructor.protected
ContentPermission
(String type, String groupName, ConfluenceUser user) protected
ContentPermission
(String type, String groupName, String userName) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ContentPermission that) static ContentPermission
createGroupPermission
(String type, String groupName) static ContentPermission
createUserPermission
(String type, ConfluenceUser user) static ContentPermission
createUserPermission
(String type, String userName) Deprecated.since 5.2.boolean
getType()
Deprecated.since 5.2.WhenisUserPermission()
is true, returns the user who is explicitly permitted by this permission.int
hashCode()
boolean
boolean
isPermitted
(com.atlassian.user.User user) Determine if a user is locked out by the permission.boolean
void
setOwningSet
(ContentPermissionSet owningSet) void
setSubject
(ConfluenceUser subject) toString()
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate
-
Field Details
-
VIEW_PERMISSION
- See Also:
-
EDIT_PERMISSION
- See Also:
-
SHARED_PERMISSION
- See Also:
-
-
Constructor Details
-
ContentPermission
public ContentPermission()This has to be public because theReflectiveObjectPersister
requires public default constructors. -
ContentPermission
Copy constructor. Does not copy the owning set.- Since:
- 4.0
-
ContentPermission
Deprecated.- Parameters:
type
-groupName
-userName
-
-
ContentPermission
-
-
Method Details
-
createUserPermission
Deprecated. -
createUserPermission
-
createGroupPermission
-
isPermitted
public boolean isPermitted(com.atlassian.user.User user) Determine if a user is locked out by the permission. Note, this does not take into account if the user has a general ability to override a lock (say if they are a global or space-level administrator), lock overrides must be dealt with at a higher level.content level permissions cannot be granted to anonymous users
- Parameters:
user
- the user to test against- Returns:
- true if the lock would prevent the user from editing content, false otherwise.
-
isGroupPermission
public boolean isGroupPermission() -
isUserPermission
public boolean isUserPermission() -
getType
-
getUserName
Deprecated.since 5.2. UsegetUserSubject()
instead. -
setSubject
- Since:
- 5.2
-
getUserSubject
WhenisUserPermission()
is true, returns the user who is explicitly permitted by this permission.- Since:
- 5.2
-
getGroupName
-
getOwningSet
-
setOwningSet
-
compareTo
- Specified by:
compareTo
in interfaceComparable<ContentPermission>
-
toString
-
equals
- Overrides:
equals
in classcom.atlassian.core.bean.EntityObject
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.atlassian.core.bean.EntityObject
-
ContentPermission(String, String, com.atlassian.confluence.user.ConfluenceUser)