Class SpacePermission
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- com.atlassian.confluence.core.ConfluenceEntityObject
-
- com.atlassian.confluence.security.SpacePermission
-
- All Implemented Interfaces:
Serializable,Cloneable
public class SpacePermission extends ConfluenceEntityObject implements Serializable
A SpacePermission restricts access to different functions on a space. A a SpacePermission is defined for a permissionType then that permissionType is not permitted, otherwise if it's not it's permitted.- Version:
- $Revision: 1.41 $
- Author:
- $Author: sleberrigaud $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringADMINISTER_SPACE_PERMISSIONstatic StringBROWSE_USERS_PERMISSIONA permission type to control whether a user can browse for users in the system, such as in user auto-completes or view profile information of other users.static StringCOMMENT_PERMISSIONstatic StringCONFLUENCE_ADMINISTRATOR_PERMISSIONPermission type to do anything in Confluence that can't affect the system on which it runs.static StringCREATE_ATTACHMENT_PERMISSIONstatic StringCREATE_SPACE_PERMISSIONstatic StringCREATEEDIT_PAGE_PERMISSIONstatic StringEDITBLOG_PERMISSIONstatic StringEXPORT_SPACE_PERMISSIONstatic Collection<String>GENERIC_SPACE_PERMISSIONSrepresents all permissions which can be used to build SpacePermissions.static Collection<String>GLOBAL_PERMISSIONSA list of all global permissionsstatic Collection<String>INVALID_ANONYMOUS_PERMISSIONSA list of all permissions that can not be assigned to the anonymous userstatic StringLIMITED_USE_CONFLUENCE_PERMISSIONUsers can be granted unlicensed authenticated access (limited) to Confluence, by being assigned this permission.static Collection<String>PERMISSION_TYPESA list of all possible permissionsstatic StringPERSONAL_SPACE_PERMISSIONstatic StringPROFILE_ATTACHMENT_PERMISSIONstatic Collection<String>READ_ONLY_SPACE_PERMISSIONSstatic StringREMOVE_ATTACHMENT_PERMISSIONstatic StringREMOVE_BLOG_PERMISSIONstatic StringREMOVE_COMMENT_PERMISSIONstatic StringREMOVE_MAIL_PERMISSIONstatic StringREMOVE_OWN_CONTENT_PERMISSIONstatic StringREMOVE_PAGE_PERMISSIONstatic StringSET_PAGE_PERMISSIONS_PERMISSIONstatic StringSYSTEM_ADMINISTRATOR_PERMISSIONPermission type to do anything at all in Confluence.static StringUPDATE_USER_STATUS_PERMISSIONA permission type to control whether a user can update their user status.static StringUSE_CONFLUENCE_PERMISSIONNote: this should no longer be checked directly, useConfluenceAccessManagerinstead.static StringVIEW_USER_PROFILES_PERMISSIONDeprecated.since 5.9.static StringVIEWSPACE_PERMISSIONView content within the space, including pages, blogposts etc.
-
Constructor Summary
Constructors Constructor Description SpacePermission()Deprecated.SpacePermission(SpacePermission spacePermission)Deprecated.SpacePermission(String type)Deprecated.SpacePermission(String type, @Nullable Space space, @Nullable String group, @Nullable ConfluenceUser subject)Deprecated.SpacePermission(String type, @Nullable Space space, @Nullable String group, @Nullable String userName)Deprecated.since 3.0, as passing both group and userName leads to an invalid permissionSpacePermission(String type, @Nullable Space space, String group)Deprecated.SpacePermission(String type, Space space)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SpacePermissioncreateAnonymousSpacePermission(String type, @Nullable Space space)static SpacePermissioncreateAuthenticatedUsersSpacePermission(String type, @Nullable Space space)Creates a permission which is granted to all authenticated users, including unlicensed users.static SpacePermissioncreateGroupSpacePermission(String type, @Nullable Space space, String group)static SpacePermissioncreateUserSpacePermission(String type, @Nullable Space space, ConfluenceUser subject)static SpacePermissioncreateUserSpacePermission(String type, @Nullable Space space, String userName)Deprecated.since 5.2.booleanequals(Object obj)StringgetAllUsersSubject()@Nullable StringgetGroup()@Nullable SpacegetSpace()The space of this permission.longgetSpaceId()StringgetType()@Nullable StringgetUserName()Deprecated.since 5.2.@Nullable ConfluenceUsergetUserSubject()inthashCode()booleanisAnonymousPermission()booleanisAuthenticatedUsersPermission()booleanisDependentOn(SpacePermission otherPermission)One permission is dependent on another if the other permission is a guard permission that applies to the same space/global scope, and to the same group / user / "all users" subject as this permission.booleanisGlobalPermission()booleanisGroupPermission()booleanisGuardPermission()Is this a guard permission, either globally or at the space level? Guard permissions are required before any more permissions can be added for a particular user/group in a particular scope.booleanisInvalidAnonymousPermission()Some permissions are not valid as they can not be assigned to the anonymous user.booleanisInvalidAuthenticatedUsersPermission()booleanisSpacePermission()booleanisUserPermission()static booleanisValidAnonymousPermission(String permissionType)static booleanisValidAuthenticatedUsersPermission(String permissionType)protected voidsetAllUsersSubject(String storedValue)voidsetGroup(String group)Deprecated.since 5.9.voidsetSpace(@Nullable Space space)voidsetType(String type)Deprecated.since 5.9.voidsetUserName(String userName)Deprecated.since 5.2.voidsetUserSubject(@Nullable ConfluenceUser user)Deprecated.StringtoFormParameterName(String parameterType)Deprecated.As of 2.7.2, usePermissionRow.buildParameterName(String, String).StringtoString()-
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreator, getCreatorName, getLastModifier, getLastModifierName, getRealClass, isPersistent, setCreator, setCreatorName, setLastModifier, setLastModifierName
-
-
-
-
Field Detail
-
USE_CONFLUENCE_PERMISSION
public static final String USE_CONFLUENCE_PERMISSION
Note: this should no longer be checked directly, useConfluenceAccessManagerinstead.- See Also:
- Constant Field Values
-
LIMITED_USE_CONFLUENCE_PERMISSION
public static final String LIMITED_USE_CONFLUENCE_PERMISSION
Users can be granted unlicensed authenticated access (limited) to Confluence, by being assigned this permission. Do not check this permission directly, useConfluenceAccessManagerOR annotations such asRequiresAnyConfluenceAccessinstead.- Since:
- 5.9
- See Also:
- Constant Field Values
-
UPDATE_USER_STATUS_PERMISSION
public static final String UPDATE_USER_STATUS_PERMISSION
A permission type to control whether a user can update their user status.- See Also:
- Constant Field Values
-
VIEW_USER_PROFILES_PERMISSION
@Deprecated public static final String VIEW_USER_PROFILES_PERMISSION
Deprecated.since 5.9. UseBROWSE_USERS_PERMISSIONinstead.A permission type to control whether a user can view user profiles within the system. This only applies to the anonymous and unlicensed users.- See Also:
- Constant Field Values
-
BROWSE_USERS_PERMISSION
public static final String BROWSE_USERS_PERMISSION
A permission type to control whether a user can browse for users in the system, such as in user auto-completes or view profile information of other users. This currently only applies to the anonymous and unlicensed users, but may be expanded in future.- See Also:
- Constant Field Values
-
SYSTEM_ADMINISTRATOR_PERMISSION
public static final String SYSTEM_ADMINISTRATOR_PERMISSION
Permission type to do anything at all in Confluence. Users with this permission should be allowed to do virtually anything in Confluence. All actions should check for this permission.- See Also:
- Constant Field Values
-
CONFLUENCE_ADMINISTRATOR_PERMISSION
public static final String CONFLUENCE_ADMINISTRATOR_PERMISSION
Permission type to do anything in Confluence that can't affect the system on which it runs. Users with this permission should be allowed to perform most administration tasks but not install plugins or write macros.- See Also:
- Constant Field Values
-
PERSONAL_SPACE_PERMISSION
public static final String PERSONAL_SPACE_PERMISSION
- See Also:
- Constant Field Values
-
CREATE_SPACE_PERMISSION
public static final String CREATE_SPACE_PERMISSION
- See Also:
- Constant Field Values
-
PROFILE_ATTACHMENT_PERMISSION
public static final String PROFILE_ATTACHMENT_PERMISSION
- See Also:
- Constant Field Values
-
VIEWSPACE_PERMISSION
public static final String VIEWSPACE_PERMISSION
View content within the space, including pages, blogposts etc.- See Also:
- Constant Field Values
-
REMOVE_OWN_CONTENT_PERMISSION
public static final String REMOVE_OWN_CONTENT_PERMISSION
- See Also:
- Constant Field Values
-
COMMENT_PERMISSION
public static final String COMMENT_PERMISSION
- See Also:
- Constant Field Values
-
CREATEEDIT_PAGE_PERMISSION
public static final String CREATEEDIT_PAGE_PERMISSION
- See Also:
- Constant Field Values
-
ADMINISTER_SPACE_PERMISSION
public static final String ADMINISTER_SPACE_PERMISSION
- See Also:
- Constant Field Values
-
REMOVE_PAGE_PERMISSION
public static final String REMOVE_PAGE_PERMISSION
- See Also:
- Constant Field Values
-
REMOVE_COMMENT_PERMISSION
public static final String REMOVE_COMMENT_PERMISSION
- See Also:
- Constant Field Values
-
REMOVE_BLOG_PERMISSION
public static final String REMOVE_BLOG_PERMISSION
- See Also:
- Constant Field Values
-
CREATE_ATTACHMENT_PERMISSION
public static final String CREATE_ATTACHMENT_PERMISSION
- See Also:
- Constant Field Values
-
REMOVE_ATTACHMENT_PERMISSION
public static final String REMOVE_ATTACHMENT_PERMISSION
- See Also:
- Constant Field Values
-
EDITBLOG_PERMISSION
public static final String EDITBLOG_PERMISSION
- See Also:
- Constant Field Values
-
EXPORT_SPACE_PERMISSION
public static final String EXPORT_SPACE_PERMISSION
- See Also:
- Constant Field Values
-
REMOVE_MAIL_PERMISSION
public static final String REMOVE_MAIL_PERMISSION
- See Also:
- Constant Field Values
-
SET_PAGE_PERMISSIONS_PERMISSION
public static final String SET_PAGE_PERMISSIONS_PERMISSION
- See Also:
- Constant Field Values
-
PERMISSION_TYPES
public static final Collection<String> PERMISSION_TYPES
A list of all possible permissions
-
GENERIC_SPACE_PERMISSIONS
public static final Collection<String> GENERIC_SPACE_PERMISSIONS
represents all permissions which can be used to build SpacePermissions.
-
READ_ONLY_SPACE_PERMISSIONS
public static final Collection<String> READ_ONLY_SPACE_PERMISSIONS
-
GLOBAL_PERMISSIONS
public static final Collection<String> GLOBAL_PERMISSIONS
A list of all global permissions
-
INVALID_ANONYMOUS_PERMISSIONS
public static final Collection<String> INVALID_ANONYMOUS_PERMISSIONS
A list of all permissions that can not be assigned to the anonymous user
-
-
Constructor Detail
-
SpacePermission
@Deprecated public SpacePermission()
Deprecated.
-
SpacePermission
@Deprecated public SpacePermission(String type)
Deprecated.
-
SpacePermission
@Deprecated public SpacePermission(String type, Space space)
Deprecated.
-
SpacePermission
@Deprecated public SpacePermission(String type, @Nullable Space space, String group)
Deprecated.
-
SpacePermission
@Deprecated public SpacePermission(String type, @Nullable Space space, @Nullable String group, @Nullable String userName)
Deprecated.since 3.0, as passing both group and userName leads to an invalid permission
-
SpacePermission
@Deprecated public SpacePermission(String type, @Nullable Space space, @Nullable String group, @Nullable ConfluenceUser subject)
Deprecated.- Since:
- 5.2
-
SpacePermission
@Deprecated public SpacePermission(SpacePermission spacePermission)
Deprecated.Creates a new SpacePermission with the attributes of another. Does not copy the id, or otherConfluenceEntityObjectstate.- Parameters:
spacePermission- a spacePermission to replicate.
-
-
Method Detail
-
getSpace
public @Nullable Space getSpace()
The space of this permission.
-
setSpace
public void setSpace(@Nullable Space space)
-
getSpaceId
public long getSpaceId()
-
getType
public String getType()
-
setType
@Deprecated public void setType(String type)
Deprecated.since 5.9. Use one of the factory methods such ascreateGroupSpacePermission(java.lang.String, com.atlassian.confluence.spaces.Space, java.lang.String)instead.
-
getGroup
public @Nullable String getGroup()
-
setGroup
@Deprecated public void setGroup(String group)
Deprecated.
-
getAllUsersSubject
public String getAllUsersSubject()
-
setAllUsersSubject
protected void setAllUsersSubject(String storedValue)
-
getUserName
@Deprecated public @Nullable String getUserName()
Deprecated.since 5.2. UsegetUserSubject()instead.
-
setUserName
@Deprecated public void setUserName(String userName)
Deprecated.since 5.2. SeesetUserSubject(ConfluenceUser)instead.
-
getUserSubject
public @Nullable ConfluenceUser getUserSubject()
- Since:
- 5.2
-
setUserSubject
public void setUserSubject(@Nullable ConfluenceUser user)
Deprecated.- Since:
- 5.2
-
isUserPermission
@EnsuresNonNullIf(expression={"getUserSubject()","getUserName()"}, result=true) public boolean isUserPermission()
-
isGroupPermission
@EnsuresNonNullIf(expression="getGroup()", result=true) public boolean isGroupPermission()
-
isAnonymousPermission
public boolean isAnonymousPermission()
-
isAuthenticatedUsersPermission
public boolean isAuthenticatedUsersPermission()
- Since:
- 5.9
-
isGlobalPermission
@EnsuresNonNullIf(expression="getSpace()", result=false) public boolean isGlobalPermission()
-
isSpacePermission
@EnsuresNonNullIf(expression="getSpace()", result=true) public boolean isSpacePermission()
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classcom.atlassian.core.bean.EntityObject
-
hashCode
public int hashCode()
- Overrides:
hashCodein classcom.atlassian.core.bean.EntityObject
-
toFormParameterName
@Deprecated public String toFormParameterName(String parameterType)
Deprecated.As of 2.7.2, usePermissionRow.buildParameterName(String, String).Convert the space permission into a form parameter name that can be used for form checkboxes. The reverse of this method isPermissionsFormHandler.fromFormParameterName(java.lang.String, com.atlassian.confluence.spaces.Space, java.lang.String)The format of the parameter name is:
confluence_[parameterType]_[permissionType]_[user/group/anonymous]_[user/group name]Note: the space is NOT encoded in the form parameter name, and must be kept separately.
- Parameters:
parameterType- distinguishes the parameter from other parameters created with the same permission.- Returns:
- the space permission as a form parameter.
-
isGuardPermission
public boolean isGuardPermission()
Is this a guard permission, either globally or at the space level? Guard permissions are required before any more permissions can be added for a particular user/group in a particular scope. Globally, USE_CONFLUENCE and LIMITED_USE_CONFLUENCE are guard permissions, at the space level, VIEWSPACE is the guard.- Returns:
- true if this is a guard permission, false otherwise.
-
isDependentOn
public boolean isDependentOn(SpacePermission otherPermission)
One permission is dependent on another if the other permission is a guard permission that applies to the same space/global scope, and to the same group / user / "all users" subject as this permission. It is used when determining which permissions should be removed as the result of removing a guard permission.- Parameters:
otherPermission- - permission to check against- Returns:
- true if this permission is dependent on otherPermission, false otherwise.
-
isInvalidAnonymousPermission
public boolean isInvalidAnonymousPermission()
Some permissions are not valid as they can not be assigned to the anonymous user. Really, we should just refuse to create such permissions from the outset, but for now we've just got this check.- Returns:
- true if this permission is invalid due to being anonymous, and of a type not available to anonymous users
-
isValidAnonymousPermission
public static boolean isValidAnonymousPermission(String permissionType)
-
isInvalidAuthenticatedUsersPermission
public boolean isInvalidAuthenticatedUsersPermission()
- Returns:
- true if this permission is for authenticated
-
isValidAuthenticatedUsersPermission
public static boolean isValidAuthenticatedUsersPermission(String permissionType)
-
createAnonymousSpacePermission
public static SpacePermission createAnonymousSpacePermission(String type, @Nullable Space space)
-
createUserSpacePermission
@Deprecated public static SpacePermission createUserSpacePermission(String type, @Nullable Space space, String userName)
Deprecated.
-
createUserSpacePermission
public static SpacePermission createUserSpacePermission(String type, @Nullable Space space, ConfluenceUser subject)
-
createGroupSpacePermission
public static SpacePermission createGroupSpacePermission(String type, @Nullable Space space, String group)
-
createAuthenticatedUsersSpacePermission
public static SpacePermission createAuthenticatedUsersSpacePermission(String type, @Nullable Space space)
Creates a permission which is granted to all authenticated users, including unlicensed users.
-
-