jetbrains.buildServer.serverSide.auth
Class Permissions

java.lang.Object
  extended by jetbrains.buildServer.serverSide.auth.Permissions

public class Permissions
extends java.lang.Object

Represents a group of permissions.


Field Summary
static Permissions NO_PERMISSIONS
          Empty set of permissions
 
Constructor Summary
Permissions(java.util.BitSet mask)
          Constructs permission group from specified bit set
Permissions(java.util.Collection<Permission> permissions)
          Initializes permission group from the permissions collection
Permissions(Permission... permissions)
          Initializes permission group from the permissions array
 
Method Summary
 boolean contains(Permission permission)
          Returns true if this group of permissions contains the specified permission
 boolean containsAll(Permissions permissions)
          Returns true if this group of permissions contains all of the specified permissions
 boolean containsAny(Permissions permissions)
          Returns true if this group of permissions contains at least one permission from the specified group.
 boolean equals(java.lang.Object o)
           
 java.util.BitSet getMask()
          Returns bit set of the permissions contained in this group
 int hashCode()
           
 Permission[] toArray()
          Converts this group to array of permissions corresponding to bit set contained within this group
 java.util.List<Permission> toList()
          Returns this group of permissions as list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_PERMISSIONS

public static final Permissions NO_PERMISSIONS
Empty set of permissions

Constructor Detail

Permissions

public Permissions(java.util.BitSet mask)
Constructs permission group from specified bit set

Parameters:
mask - bit set

Permissions

public Permissions(@NotNull
                   Permission... permissions)
Initializes permission group from the permissions array

Parameters:
permissions - permissions to include into the group

Permissions

public Permissions(@NotNull
                   java.util.Collection<Permission> permissions)
Initializes permission group from the permissions collection

Parameters:
permissions - permissions to include into the group
Method Detail

contains

public boolean contains(Permission permission)
Returns true if this group of permissions contains the specified permission

Parameters:
permission - permission to check
Returns:
true if specified permission is in the group

containsAny

public boolean containsAny(Permissions permissions)
Returns true if this group of permissions contains at least one permission from the specified group.

Parameters:
permissions - permissions to check
Returns:
true if at least one permission from the specified group is contained in this group.

containsAll

public boolean containsAll(Permissions permissions)
Returns true if this group of permissions contains all of the specified permissions

Parameters:
permissions - permissions to check
Returns:
true if all of the specified permissions are contained in this group

toArray

public Permission[] toArray()
Converts this group to array of permissions corresponding to bit set contained within this group

Returns:
array of permissions contained in this group

toList

public java.util.List<Permission> toList()
Returns this group of permissions as list.

Returns:
list of permissions

getMask

public java.util.BitSet getMask()
Returns bit set of the permissions contained in this group

Returns:
bit set of the permissions contained in this group

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object