Class ContentPermissionSet
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- com.atlassian.confluence.security.ContentPermissionSet
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<ContentPermission>
- Direct Known Subclasses:
NeverPermittedContentPermissionSet,NeverPermittedContentPermissionSet
public class ContentPermissionSet extends com.atlassian.core.bean.EntityObject implements Iterable<ContentPermission>, Serializable
This is a container forContentPermissions linked to someContentEntityObject. EachContentEntityObjecthas a list ofContentPermissionSets. One per operation type. E.g. oneContentPermissionSetcontaining VIEWContentPermissions, another one for EDIT, etc... EachContentPermissionSethas as manyContentPermissions as there are specific users and/or groups to whom corresponding operations are restricted.
-
-
Constructor Summary
Constructors Constructor Description ContentPermissionSet()ContentPermissionSet(String type, ContentEntityObject owningContent)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddContentPermission(ContentPermission contentPermission)booleancontains(ContentPermission contentPermission)booleancontainsAll(ContentPermissionSet permissionSet)Collection<ContentPermission>contentPermissionsCopy()Retrieve a copy of the content permissions.Collection<ContentPermission>getAllExcept(Collection<ContentPermission> exclusions)Retrieve all theContentPermissions in this set that do not exist in the given collection.com.google.common.collect.ImmutableCollection<ContentPermission>getContentPermissionsCopy()Deprecated.since 7.0.1.List<String>getGroupNames()Returns the names of all groups in this Content Permission Set as a list ofStrings.ContentEntityObjectgetOwningContent()StringgetType()List<com.atlassian.sal.api.user.UserKey>getUserKeys()Returns the names of all users in this Content Permission Set as a list ofStrings.List<String>getUserNames()Deprecated.since 5.3 Use {@link #getUserKeys)}booleanisEmpty()booleanisPermitted(com.atlassian.user.User user)Iterator<ContentPermission>iterator()voidremoveContentPermission(ContentPermission contentPermission)Remove the given content permission from this set.voidsetOwningContent(ContentEntityObject owningContent)Hibernate setter.voidsetType(String type)intsize()StringtoString()-
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, equals, getCreationDate, getCurrentDate, getId, getLastModificationDate, hashCode, setClock, setCreationDate, setId, setLastModificationDate
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ContentPermissionSet
public ContentPermissionSet()
-
ContentPermissionSet
public ContentPermissionSet(String type, ContentEntityObject owningContent)
-
-
Method Detail
-
addContentPermission
public void addContentPermission(ContentPermission contentPermission)
-
removeContentPermission
public void removeContentPermission(ContentPermission contentPermission)
Remove the given content permission from this set. Does nothing if the permission is not in the set.
-
isPermitted
public boolean isPermitted(com.atlassian.user.User user)
- Returns:
- true this user passes at least one of the permissions in this set
-
getType
public String getType()
-
setType
public void setType(String type)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
contains
public boolean contains(ContentPermission contentPermission)
-
containsAll
public boolean containsAll(ContentPermissionSet permissionSet)
-
getOwningContent
public ContentEntityObject getOwningContent()
-
setOwningContent
public void setOwningContent(ContentEntityObject owningContent)
Hibernate setter.
-
iterator
public Iterator<ContentPermission> iterator()
- Specified by:
iteratorin interfaceIterable<ContentPermission>- Returns:
- an unmodifiable iterator over the
ContentPermissions in the set.
-
getGroupNames
public List<String> getGroupNames()
Returns the names of all groups in this Content Permission Set as a list ofStrings.- Returns:
- the names of all groups in this Content Permission Set as a list of
Strings.
-
getUserNames
@Deprecated public List<String> getUserNames()
Deprecated.since 5.3 Use {@link #getUserKeys)}Returns the names of all users in this Content Permission Set as a list ofStrings.
-
getUserKeys
public List<com.atlassian.sal.api.user.UserKey> getUserKeys()
Returns the names of all users in this Content Permission Set as a list ofStrings.
-
getAllExcept
public Collection<ContentPermission> getAllExcept(Collection<ContentPermission> exclusions)
Retrieve all theContentPermissions in this set that do not exist in the given collection. The comparison is done according toComparable.compareTo(Object).- Parameters:
exclusions- a collection ofContentPermissions- Returns:
- the
ContentPermissions that are in this object and not given collection.
-
getContentPermissionsCopy
@Deprecated public com.google.common.collect.ImmutableCollection<ContentPermission> getContentPermissionsCopy()
Deprecated.since 7.0.1. UsecontentPermissionsCopy()Retrieve a copy of the content permissions. We create a copy of the contentPermissions to prevent the original collection from being modified.- Returns:
- A copy of the contentPermissions
- Since:
- 5.9.2
-
contentPermissionsCopy
public Collection<ContentPermission> contentPermissionsCopy()
Retrieve a copy of the content permissions. We create a copy of the contentPermissions to prevent the original collection from being modified.- Returns:
- A copy of the contentPermissions
- Since:
- 7.0.1
-
-