Class RoleImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.RoleImpl
-
- All Implemented Interfaces:
Comparable<RoleImpl>
,Loggable
,Role
public class RoleImpl extends Object implements Role, Comparable<RoleImpl>
Role is a set of permissions and included roles with name and identifier.
-
-
Constructor Summary
Constructors Constructor Description RoleImpl(String id, String name, int orderNum, RoleManipulator manipulator)
RoleImpl(String id, String name, Permissions permissions, int orderNum, RoleManipulator manipulator)
RoleImpl(String id, String name, Permissions allowedPermissions, Permissions disabledPermissions, RoleManipulator manipulator)
RoleImpl(String id, String name, Permissions permissions, RoleManipulator roleManipulator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIncludedRole(Role includedRole)
IncludesincludedRole
to the rolevoid
addPermissions(Permission... permissions)
Adds permissions to the roleint
compareTo(RoleImpl o)
void
computeAllPermissions()
String
describe(boolean verbose)
void
disableProjectAssociation()
By default we compute whether a role can be associated to a particular project by permissions containing in the role.void
doAddDisabledPermissions(Permissions permissions)
void
doAddIncludedRole(Role role)
void
doAddPermissions(Permissions permissions)
Adds permissions to the rolevoid
doRemoveIncludedRole(Role role)
void
doRemovePermission(Permission permission)
boolean
equals(Object o)
Permissions
getDisabledOwnPermissions()
String
getId()
Returns unique identifier of this roleRole[]
getIncludedRoles()
Returns roles which are included in this roleString
getName()
Returns name of this roleint
getOrderNum()
Permissions
getOwnPermissions()
Return only own permissions of the role without inherited permissionsPermissions
getPermissions()
Returns permissions associated with this roleint
hashCode()
boolean
isProjectAssociationDisabled()
boolean
isProjectAssociationSupported()
Returns true if this role can be associated with a particular project.void
removeIncludedRole(Role includedRole)
ExcludesincludedRole
from the rolevoid
removePermission(Permission permission)
Removes permission from the roleString
toString()
-
-
-
Constructor Detail
-
RoleImpl
public RoleImpl(@NotNull String id, @NotNull String name, @NotNull Permissions permissions, @Nullable RoleManipulator roleManipulator)
-
RoleImpl
public RoleImpl(@NotNull String id, @NotNull String name, @NotNull Permissions permissions, int orderNum, @Nullable RoleManipulator manipulator)
-
RoleImpl
public RoleImpl(@NotNull String id, @NotNull String name, int orderNum, @Nullable RoleManipulator manipulator)
-
RoleImpl
public RoleImpl(@NotNull String id, @NotNull String name, @NotNull Permissions allowedPermissions, @NotNull Permissions disabledPermissions, RoleManipulator manipulator)
-
-
Method Detail
-
getOrderNum
public int getOrderNum()
-
disableProjectAssociation
public void disableProjectAssociation()
By default we compute whether a role can be associated to a particular project by permissions containing in the role. If role contains at least one project permissionPermission.isProjectAssociationSupported()
returns true, we consider that this role can be associated with a project. But sometimes it is needed to override this behaviour and disable project association for some roles even if they contain project permissions (for example, Sysadmin role).
-
isProjectAssociationDisabled
public boolean isProjectAssociationDisabled()
-
getId
@NotNull public String getId()
Returns unique identifier of this role
-
getName
@NotNull public String getName()
Returns name of this role
-
getPermissions
@NotNull public Permissions getPermissions()
Returns permissions associated with this role- Specified by:
getPermissions
in interfaceRole
- Returns:
- role permissions
-
getOwnPermissions
@NotNull public Permissions getOwnPermissions()
Description copied from interface:Role
Return only own permissions of the role without inherited permissions- Specified by:
getOwnPermissions
in interfaceRole
- Returns:
- own permissions of the role
-
getDisabledOwnPermissions
@NotNull public Permissions getDisabledOwnPermissions()
-
getIncludedRoles
@NotNull public Role[] getIncludedRoles()
Description copied from interface:Role
Returns roles which are included in this role- Specified by:
getIncludedRoles
in interfaceRole
- Returns:
- included roles
-
isProjectAssociationSupported
public boolean isProjectAssociationSupported()
Description copied from interface:Role
Returns true if this role can be associated with a particular project. This means that this role contains at least one permission that can be associated with a project.- Specified by:
isProjectAssociationSupported
in interfaceRole
- Returns:
- true if this role can be associated with a project
-
addPermissions
public void addPermissions(@NotNull Permission... permissions)
Description copied from interface:Role
Adds permissions to the role- Specified by:
addPermissions
in interfaceRole
- Parameters:
permissions
- permissions
-
removePermission
public void removePermission(@NotNull Permission permission)
Description copied from interface:Role
Removes permission from the role- Specified by:
removePermission
in interfaceRole
- Parameters:
permission
- permission
-
addIncludedRole
public void addIncludedRole(@NotNull Role includedRole)
Description copied from interface:Role
IncludesincludedRole
to the role- Specified by:
addIncludedRole
in interfaceRole
- Parameters:
includedRole
- role to include
-
removeIncludedRole
public void removeIncludedRole(@NotNull Role includedRole)
Description copied from interface:Role
ExcludesincludedRole
from the role- Specified by:
removeIncludedRole
in interfaceRole
- Parameters:
includedRole
- role to include
-
doAddPermissions
public void doAddPermissions(Permissions permissions)
Adds permissions to the role- Parameters:
permissions
- adds permissions
-
doAddDisabledPermissions
public void doAddDisabledPermissions(Permissions permissions)
-
doRemovePermission
public void doRemovePermission(@NotNull Permission permission)
-
doAddIncludedRole
public void doAddIncludedRole(@NotNull Role role)
-
doRemoveIncludedRole
public void doRemoveIncludedRole(@NotNull Role role)
-
computeAllPermissions
public void computeAllPermissions()
-
compareTo
public int compareTo(RoleImpl o)
- Specified by:
compareTo
in interfaceComparable<RoleImpl>
-
-