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 (seecom/atlassian/confluence/security/ContentPermission.hbm.xml
). Directly corresponding equivalent for ServiceLayer would beContentRestriction
Each Content has as many
ContentPermissionSet
s linked as there are operations restricted for the content. EachContentPermissionSet
has as manyContentPermission
s as there are specific users and/or groups to whom corresponding operations are restricted.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EDIT_PERMISSION
static String
SHARED_PERMISSION
static String
VIEW_PERMISSION
-
Constructor Summary
Constructors Modifier Constructor Description ContentPermission()
This has to be public because theReflectiveObjectPersister
requires public default constructors.ContentPermission(ContentPermission other)
Copy constructor.protected
ContentPermission(String type, String groupName, ConfluenceUser user)
protected
ContentPermission(String type, String groupName, String userName)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
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
equals(Object o)
String
getGroupName()
ContentPermissionSet
getOwningSet()
String
getType()
String
getUserName()
Deprecated.since 5.2.ConfluenceUser
getUserSubject()
WhenisUserPermission()
is true, returns the user who is explicitly permitted by this permission.int
hashCode()
boolean
isGroupPermission()
boolean
isPermitted(com.atlassian.user.User user)
Determine if a user is locked out by the permission.boolean
isUserPermission()
void
setOwningSet(ContentPermissionSet owningSet)
void
setSubject(ConfluenceUser subject)
String
toString()
-
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
-
-
-
-
Field Detail
-
VIEW_PERMISSION
public static final String VIEW_PERMISSION
- See Also:
- Constant Field Values
-
EDIT_PERMISSION
public static final String EDIT_PERMISSION
- See Also:
- Constant Field Values
-
SHARED_PERMISSION
public static final String SHARED_PERMISSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContentPermission
public ContentPermission()
This has to be public because theReflectiveObjectPersister
requires public default constructors.
-
ContentPermission
public ContentPermission(ContentPermission other)
Copy constructor. Does not copy the owning set.- Since:
- 4.0
-
ContentPermission
protected ContentPermission(String type, String groupName, String userName)
Deprecated.- Parameters:
type
-groupName
-userName
-
-
ContentPermission
protected ContentPermission(String type, String groupName, ConfluenceUser user)
-
-
Method Detail
-
createUserPermission
@Deprecated public static ContentPermission createUserPermission(String type, String userName)
Deprecated.
-
createUserPermission
public static ContentPermission createUserPermission(String type, ConfluenceUser user)
-
createGroupPermission
public static ContentPermission createGroupPermission(String type, String groupName)
-
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
public String getType()
-
getUserName
@Deprecated public String getUserName()
Deprecated.since 5.2. UsegetUserSubject()
instead.
-
setSubject
public void setSubject(ConfluenceUser subject)
- Since:
- 5.2
-
getUserSubject
public ConfluenceUser getUserSubject()
WhenisUserPermission()
is true, returns the user who is explicitly permitted by this permission.- Since:
- 5.2
-
getGroupName
public String getGroupName()
-
getOwningSet
public ContentPermissionSet getOwningSet()
-
setOwningSet
public void setOwningSet(ContentPermissionSet owningSet)
-
compareTo
public int compareTo(ContentPermission that)
- Specified by:
compareTo
in interfaceComparable<ContentPermission>
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classcom.atlassian.core.bean.EntityObject
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.atlassian.core.bean.EntityObject
-
-