Package jetbrains.buildServer.users.impl
Class RolesHolderImpl<T>
- java.lang.Object
-
- jetbrains.buildServer.users.impl.RolesHolderImpl<T>
-
- Type Parameters:
T- the type of holder id (for instance, Long for User)
- All Implemented Interfaces:
Loggable,RolesHolder,RolesHolderEx,UserRolesInit
public abstract class RolesHolderImpl<T> extends Object implements RolesHolderEx, UserRolesInit
Actual roles holders (like user and group) are expected to delegateRolesHolderoperations, rather than inherit fromRolesHolderImpl. AnywayRolesHolderImplis thread-safe, no surronding locks are needed.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRolesHolderImpl(SecurityContext securityContext, RolesUpdate<T> rolesUpdater, RolesManager rolesManager, RolesConverter rolesConverter, ProjectManagerEx projectManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddRole(RoleScope scope, Role role)Adds role with specified scopeCollection<RoleScope>computeExistingScopes(Map<RoleScope,Set<String>> rolesMap)Collection<RolesHolder>getAllParentHolders()Returns all parent holders including transitive onesabstract TgetHolderId()Returns id used to store rolesintgetNumberOfRolesChanges()abstract Collection<RolesHolder>getParentHolders()Returns direct (non transitive) parent holders.Collection<RoleEntry>getRoles()Returns roles with their scopesCollection<Role>getRolesWithScope(RoleScope scope)Returns all roles with specified scope.Collection<RoleScope>getScopes()Returns all scopes with assigned rolesMap<RoleScope,Collection<Role>>getUnfilteredRoles()Collection<RoleScope>getUnfilteredScopes()booleanisSystemAdministratorRoleGranted()Returns true if this roles holder contains system administrator role granted directly or inherited via parent holders.booleanisSystemAdministratorRoleGrantedDirectly()Returns true if this roles holder contains system administrator role granted directly.booleanisSystemAdministratorRoleInherited()Returns true if one of the parents (transitively) of this roles holder contains system administrator role.abstract Map<RoleScope,Set<Role>>loadRoles()voidremoveRole(Role role)Removes specified role.voidremoveRole(RoleScope scope, Role role)Removes role with specified scopevoidremoveRoles(RoleScope scope)Removes all of the roles having the specified scope.voidresetRoles()Causes roles reloading from the database.
-
-
-
Constructor Detail
-
RolesHolderImpl
protected RolesHolderImpl(@NotNull SecurityContext securityContext, @NotNull RolesUpdate<T> rolesUpdater, @NotNull RolesManager rolesManager, @NotNull RolesConverter rolesConverter, @NotNull ProjectManagerEx projectManager)
-
-
Method Detail
-
getRolesWithScope
@NotNull public Collection<Role> getRolesWithScope(@NotNull RoleScope scope)
Description copied from interface:RolesHolderReturns all roles with specified scope.- Specified by:
getRolesWithScopein interfaceRolesHolder- Parameters:
scope- roles scope- Returns:
- all roles with specified scope.
-
getScopes
public Collection<RoleScope> getScopes()
Description copied from interface:RolesHolderReturns all scopes with assigned roles- Specified by:
getScopesin interfaceRolesHolder- Returns:
- all scopes with assigned roles
-
getUnfilteredScopes
@NotNull public Collection<RoleScope> getUnfilteredScopes()
- Specified by:
getUnfilteredScopesin interfaceRolesHolderEx- Returns:
- unfiltered role scopes for this roles holder, unfiltered scopes include scopes for projects current user from security context does not have access too
-
computeExistingScopes
@NotNull public Collection<RoleScope> computeExistingScopes(@NotNull Map<RoleScope,Set<String>> rolesMap)
-
getUnfilteredRoles
@NotNull public Map<RoleScope,Collection<Role>> getUnfilteredRoles()
- Specified by:
getUnfilteredRolesin interfaceRolesHolderEx- Returns:
- unfiltered map of role for this roles holder, unfiltered map include roles for projects current user from security context does not have access too
-
getRoles
@NotNull public Collection<RoleEntry> getRoles()
Description copied from interface:RolesHolderReturns roles with their scopes- Specified by:
getRolesin interfaceRolesHolder- Returns:
- roles with their scopes
-
addRole
public void addRole(@NotNull RoleScope scope, @NotNull Role role)Description copied from interface:RolesHolderAdds role with specified scope- Specified by:
addRolein interfaceRolesHolder- Parameters:
scope- scope of the rolerole- role
-
removeRole
public void removeRole(@NotNull RoleScope scope, @NotNull Role role)Description copied from interface:RolesHolderRemoves role with specified scope- Specified by:
removeRolein interfaceRolesHolder- Parameters:
scope- scope of the rolerole- role
-
removeRole
public void removeRole(@NotNull Role role)Description copied from interface:RolesHolderRemoves specified role. If the role is associated with several scopes all of these roles will be removed.- Specified by:
removeRolein interfaceRolesHolder- Parameters:
role- role to remove
-
removeRoles
public void removeRoles(@NotNull RoleScope scope)Description copied from interface:RolesHolderRemoves all of the roles having the specified scope.- Specified by:
removeRolesin interfaceRolesHolder- Parameters:
scope- scope of the role
-
isSystemAdministratorRoleGranted
public boolean isSystemAdministratorRoleGranted()
Description copied from interface:RolesHolderReturns true if this roles holder contains system administrator role granted directly or inherited via parent holders. Same as:isSystemAdministratorRoleGrantedDirectly() || isSystemAdministratorRoleInherited()
- Specified by:
isSystemAdministratorRoleGrantedin interfaceRolesHolder- Returns:
- see above.
-
isSystemAdministratorRoleGrantedDirectly
public boolean isSystemAdministratorRoleGrantedDirectly()
Description copied from interface:RolesHolderReturns true if this roles holder contains system administrator role granted directly.- Specified by:
isSystemAdministratorRoleGrantedDirectlyin interfaceRolesHolder- Returns:
- see above.
-
isSystemAdministratorRoleInherited
public boolean isSystemAdministratorRoleInherited()
Description copied from interface:RolesHolderReturns true if one of the parents (transitively) of this roles holder contains system administrator role.- Specified by:
isSystemAdministratorRoleInheritedin interfaceRolesHolder- Returns:
- see above
-
resetRoles
public void resetRoles()
Description copied from interface:UserRolesInitCauses roles reloading from the database.- Specified by:
resetRolesin interfaceUserRolesInit
-
getHolderId
public abstract T getHolderId()
Returns id used to store roles- Returns:
- roles holder id
-
getParentHolders
@NotNull public abstract Collection<RolesHolder> getParentHolders()
Description copied from interface:RolesHolderReturns direct (non transitive) parent holders.- Specified by:
getParentHoldersin interfaceRolesHolder- Returns:
- parent holders
-
getAllParentHolders
@NotNull public Collection<RolesHolder> getAllParentHolders()
Description copied from interface:RolesHolderReturns all parent holders including transitive ones- Specified by:
getAllParentHoldersin interfaceRolesHolder- Returns:
- all parent holders
-
getNumberOfRolesChanges
public int getNumberOfRolesChanges()
-
-