Class UserGroupImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.Proxyfied<UserGroupEx>
-
- jetbrains.buildServer.groups.impl.UserGroupImpl
-
- All Implemented Interfaces:
Comparable<UserGroup>,SUserGroup,UserGroup,UserGroupEx,Loggable,NotificationRulesHolder,AuthorityHolder,RolesHolder,RolesHolderEx,PropertyHolder,SPropertyHolder
- Direct Known Subclasses:
AllUsersGroup
public class UserGroupImpl extends Proxyfied<UserGroupEx> implements UserGroupEx
User group implementation. Thread-safe.Caveat (for future development): this class and
UserGroupManagerImpluse read-write locks for thread-safety. Unfortunately, sometimes nested locks are required (for instance, insetName(String)). Hence a proper care should be exercised to avoid dead-locks.I use the following convention: in case of nested locking USERGROUP_LOCK should be locked first.
If you wish to add a new property to user groups (like subgroups, or notification rules, etc), and you want to cache it, make sure that:
- the data is loaded from DB in
UserGroupImpl(java.lang.String, java.lang.String, java.lang.String, jetbrains.buildServer.groups.UserGroupManager, jetbrains.buildServer.users.UserModel, jetbrains.buildServer.users.impl.RolesConverter, jetbrains.buildServer.serverSide.SecurityContextEx, jetbrains.buildServer.serverSide.auth.RolesManager, jetbrains.buildServer.notification.UserGroupNotificationRulesManager, jetbrains.buildServer.groups.impl.UserGroupUpdater, jetbrains.buildServer.groups.impl.UserGroupRoleUpdater, jetbrains.buildServer.groups.impl.UserGroupUserUpdater, jetbrains.buildServer.groups.impl.UserGroupSubgroupUpdater, jetbrains.buildServer.groups.impl.UserGroupPropertyLoader, jetbrains.buildServer.groups.impl.UserGroupPropertyUpdater, jetbrains.buildServer.serverSide.ProjectManagerEx, jetbrains.buildServer.serverSide.audit.AuditLogFactory, jetbrains.buildServer.groups.impl.UserGroupsCrossNodesEvents, jetbrains.buildServer.util.EventDispatcher<jetbrains.buildServer.groups.UserGroupListener>)c'tor; - the data is removed from DB in
dispose().
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaddNewRule(String notifierType, NotificationRule rule)Adds new rule to the rules of specified user for specified notifier type.voidaddParent(UserGroup parent)Adds the parent group.voidaddRole(RoleScope scope, Role role)Adds role with specified scopevoidaddSubgroup(UserGroup group)Subgroups.voidaddSubgroups(Collection<UserGroup> subgroups)Adds a set of subgroups atomicly.voidaddUser(User user)Users.voidapplyOrder(String notifierType, long[] ruleIds)Sorts the notification rules in the specified order.voidcalculatePermissions(BitSet globalPerms, Map<String,Permissions> projectPerms)Calculates the permissions of this user group and fillsglobalPermsandprojectPermswith results.voidcleanupGroup()Removes from the group users, which were removed on the serverintcompareTo(UserGroup obj)booleancontainsUserDirectly(User user)voiddeleteGroupProperty(PropertyKey propertyKey)Deletes a property with specified key from this group.booleandeleteProperty(PropertyKey propertyKey)Deletes a property with specified key.Stringdescribe(boolean verbose)voiddispose()Other.booleanequals(Object obj)Collection<Long>findConflictingRules(String notifierType, WatchedBuilds watch)Searches for rules which intersect with specified watched builds.NotificationRulefindRuleById(long ruleId)Searches for a rule with specified id.Collection<RolesHolder>getAllParentHolders()Returns all parent holders including transitive onesList<NotificationRulesHolder>getAllParentRulesHolders()Returns all (direct and inherited) parent notification rules holdersPair<Permissions,Map<String,Permissions>>getAllPermissions()Returns both global and project permissions at once.List<UserGroup>getAllSubgroups()Returns the set of all subgroups included into this group, directly or through intermediate ones.List<User>getAllUsers()Returns the set of all users included into this group, directly or through subgroups.UsergetAssociatedUser()Returns the user object associated with the principal.booleangetBooleanProperty(PropertyKey propertyKey)Returns value of the boolean propertyStringgetDescription()Returns a description of this group.List<UserGroup>getDirectSubgroups()Returns the collection of subgroups that are directly included into this group.List<User>getDirectUsers()Returns the collection of users included into this group.PermissionsgetGlobalPermissions()Returns all granted non-project related permissions and all project-related permissions granted globallyStringgetKey()General user group data.StringgetName()Returns a displayable name of this group.List<NotificationRule>getNotificationRules(String notifierType)Notification rules.List<UserGroup>getParentGroups()Parent groups.Collection<RolesHolder>getParentHolders()Returns direct (non transitive) parent holders.List<NotificationRulesHolder>getParentRulesHolders()Returns direct parent notification rules holdersPermissionsgetPermissionsGrantedForAllProjects(Collection<String> projectIds)Returns all permissions granted for all projects from the collection.PermissionsgetPermissionsGrantedForAnyOfProjects(Collection<String> projectIds)Returns union of permissions granted for projects from the collection.PermissionsgetPermissionsGrantedForProject(String projectId)Returns all permissions granted for particular project.Map<String,Permissions>getProjectsPermissions()Returns map of project-related permissions that were granted for a particular project.Map<PropertyKey,String>getProperties()Returns map of the propertiesStringgetPropertyValue(PropertyKey propertyKey)Properties.Collection<RoleEntry>getRoles()Returns roles with their scopesCollection<Role>getRolesWithScope(RoleScope scope)Permissions.Collection<RoleScope>getScopes()Returns all scopes with assigned rolesMap<RoleScope,Collection<Role>>getUnfilteredRoles()Collection<RoleScope>getUnfilteredScopes()intgetUsersNumber()Returns the number of (direct) users in this group.booleanhasAllPermissionsOf(AuthorityHolder authorityHolder)Returns true if this authority holder has all permissions of another authority holder.inthashCode()booleanhasParents()Returns whether this group has parent groups.booleanisAllUsersGroup()Returns true, if the specified group is the all-users group.booleanisPermissionGrantedForAllProjects(Collection<String> projectIds, Permission permission)Returns true if permission is granted for all projects from the given list.booleanisPermissionGrantedForAnyOfProjects(Collection<String> projectIds, Permission permission)Returns true if specified permission is granted for at least one project from the given collectionbooleanisPermissionGrantedForAnyProject(Permission permission)Returns true if specified permission is granted for at least one projectbooleanisPermissionGrantedForProject(String projectId, Permission permission)Returns true if permission is granted for a project, i.e.booleanisPermissionGrantedGlobally(Permission permission)Authority.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.voidremoveParent(UserGroup parent)Removes the parent group.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.voidremoveRule(long ruleId)Removes the rule with specified id.voidremoveRule(NotificationRule rule)Removes the rule.voidremoveSubgroup(UserGroup group)Removes a direct subgroup.voidremoveUser(User user)Removes a user from this group.voidresetRoles()Resets internal roles cachevoidsetDescription(String description)Sets the group description.voidsetGroupProperties(Map<? extends PropertyKey,String> properties)Updates properties of this group.voidsetGroupProperty(PropertyKey propertyKey, String value)Sets a property with specified key and value in this group.voidsetName(String name)Sets the group name.voidsetNotificationRules(String notifierType, List<NotificationRule> rules)Sets the notification rules for specified notifier.booleansetProperties(Map<? extends PropertyKey,String> properties)Updates the specified properties.booleansetProperty(PropertyKey propertyKey, String value)Sets a property with specified key and value.StringtoString()voidupdateInfo()Reload main group info (name and description) from the databasevoidupdateProperties()Reload group properties from the databasevoidupdateRoles()Reload group roles from the databasevoidupdateSubgroups()Reload group direct subgroups from the databasevoidupdateUsers()Reload group users from the database
-
-
-
Method Detail
-
getKey
@NotNull public String getKey()
General user group data.
-
getName
@NotNull public String getName()
Description copied from interface:UserGroupReturns a displayable name of this group. The name is unique among all groups, but in contrast with group key is modifiable.
-
setName
public void setName(@NotNull String name) throws UserGroupExceptionDescription copied from interface:SUserGroupSets the group name.Note: group name must be unique among all user groups. If
namealready exists, an exception is thrown.The name cannot be empty and cannot exceed 255 characters.
- Specified by:
setNamein interfaceSUserGroup- Parameters:
name- the new group name- Throws:
UserGroupException- if name already exists, or is empty, or is too long- See Also:
UserGroup.getName()
-
setDescription
public void setDescription(@NotNull String description) throws UserGroupExceptionDescription copied from interface:SUserGroupSets the group description.The description cannot exceed 2000 characters.
- Specified by:
setDescriptionin interfaceSUserGroup- Parameters:
description- the new description- Throws:
UserGroupException- if description is too long- See Also:
UserGroup.getDescription()
-
getDescription
@NotNull public String getDescription()
Description copied from interface:UserGroupReturns a description of this group.- Specified by:
getDescriptionin interfaceUserGroup- Returns:
- group description
-
compareTo
public int compareTo(UserGroup obj)
- Specified by:
compareToin interfaceComparable<UserGroup>
-
addSubgroup
public void addSubgroup(@NotNull UserGroup group) throws UserGroupExceptionSubgroups.- Specified by:
addSubgroupin interfaceSUserGroup- Parameters:
group- a subgroup to add- Throws:
UserGroupException- if addition of the subgroup leads to a cycle
-
addSubgroups
public void addSubgroups(@NotNull Collection<UserGroup> subgroups) throws UserGroupExceptionDescription copied from interface:UserGroupExAdds a set of subgroups atomicly. The same rules as inSUserGroup.addSubgroup(UserGroup)apply.- Specified by:
addSubgroupsin interfaceUserGroupEx- Parameters:
subgroups- the subgroups to be added- Throws:
UserGroupException- in case of error (seeSUserGroup.addSubgroup(UserGroup))
-
removeSubgroup
@Secured("MANAGE_USERGROUP") public void removeSubgroup(@NotNull UserGroup group)
Description copied from interface:SUserGroupRemoves a direct subgroup. Does nothing if the subgroup is included indirectly.- Specified by:
removeSubgroupin interfaceSUserGroup- Parameters:
group- a subgroup to remove
-
getDirectSubgroups
@NotNull public List<UserGroup> getDirectSubgroups()
Description copied from interface:UserGroupReturns the collection of subgroups that are directly included into this group.- Specified by:
getDirectSubgroupsin interfaceUserGroup- Returns:
- list of direct subgroups
- See Also:
UserGroup.getAllSubgroups(),UserGroup.getParentGroups()
-
getAllSubgroups
@NotNull public List<UserGroup> getAllSubgroups()
Description copied from interface:UserGroupReturns the set of all subgroups included into this group, directly or through intermediate ones.- Specified by:
getAllSubgroupsin interfaceUserGroup- Returns:
- list of all subgroups
- See Also:
UserGroup.getDirectSubgroups()
-
getParentGroups
@NotNull public List<UserGroup> getParentGroups()
Parent groups.- Specified by:
getParentGroupsin interfaceUserGroup- Returns:
- list of direct parents
- See Also:
UserGroup.getDirectSubgroups()
-
addParent
public void addParent(@NotNull UserGroup parent)Description copied from interface:UserGroupExAdds the parent group.Do not call this method directly! It should be consistent with
addSubgroup.- Specified by:
addParentin interfaceUserGroupEx- Parameters:
parent- the parent to add
-
removeParent
public void removeParent(@NotNull UserGroup parent)Description copied from interface:UserGroupExRemoves the parent group.Do not call this method directly! It should be consistent with
removeSubgroup.- Specified by:
removeParentin interfaceUserGroupEx- Parameters:
parent- the parent to remove
-
hasParents
public boolean hasParents()
Description copied from interface:UserGroupExReturns whether this group has parent groups. Using this method is faster than!getParentGroups().isEmpty()- Specified by:
hasParentsin interfaceUserGroupEx- Returns:
- true if this group has parent groups
-
addUser
public void addUser(@NotNull User user)Users.- Specified by:
addUserin interfaceSUserGroup- Parameters:
user- the user to add
-
removeUser
public void removeUser(@NotNull User user) throws UserGroupExceptionDescription copied from interface:SUserGroupRemoves a user from this group. Does nothing if the user is not included into this group directly.The user isn't allowed to remove himself from any group.
- Specified by:
removeUserin interfaceSUserGroup- Parameters:
user- a user to remove- Throws:
UserGroupException- if user is the authority holder, trying to remove himself
-
getDirectUsers
@NotNull public List<User> getDirectUsers()
Description copied from interface:UserGroupReturns the collection of users included into this group. This method ignores the subgroups.- Specified by:
getDirectUsersin interfaceUserGroup- Returns:
- list of users
- See Also:
UserGroup.getAllUsers()
-
getAllUsers
@NotNull public List<User> getAllUsers()
Description copied from interface:UserGroupReturns the set of all users included into this group, directly or through subgroups.- Specified by:
getAllUsersin interfaceUserGroup- Returns:
- list of all users
- See Also:
UserGroup.getDirectUsers()
-
containsUserDirectly
public boolean containsUserDirectly(@NotNull User user)- Specified by:
containsUserDirectlyin interfaceUserGroup- Parameters:
user- user to check- Returns:
- true if this group contains user directly (user is returned by getDirectUsers)
-
getUsersNumber
public int getUsersNumber()
Description copied from interface:UserGroupExReturns the number of (direct) users in this group. Much more effective thangetDirectUsers().size().- Specified by:
getUsersNumberin interfaceUserGroupEx- Returns:
- the number of users in the group
-
getPropertyValue
@Nullable public String getPropertyValue(PropertyKey propertyKey)
Properties.- Specified by:
getPropertyValuein interfacePropertyHolder- Parameters:
propertyKey- value of the property with specified key- Returns:
- value of the property with specified key
-
getBooleanProperty
public boolean getBooleanProperty(PropertyKey propertyKey)
Description copied from interface:PropertyHolderReturns value of the boolean property- Specified by:
getBooleanPropertyin interfacePropertyHolder- Parameters:
propertyKey- property key- Returns:
- value
-
getProperties
@NotNull public Map<PropertyKey,String> getProperties()
Description copied from interface:PropertyHolderReturns map of the properties- Specified by:
getPropertiesin interfacePropertyHolder- Returns:
- map of the properties
-
setProperties
public boolean setProperties(@NotNull Map<? extends PropertyKey,String> properties)Description copied from interface:SPropertyHolderUpdates the specified properties. Only those properties will be updated which keys are specified in the properties map. All other properties will be left intact.- Specified by:
setPropertiesin interfaceSPropertyHolder- Parameters:
properties- properties- Returns:
- true if at least one property was changed, false otherwise
-
setProperty
public boolean setProperty(@NotNull PropertyKey propertyKey, String value)Description copied from interface:SPropertyHolderSets a property with specified key and value.- Specified by:
setPropertyin interfaceSPropertyHolder- Parameters:
propertyKey- property keyvalue- value of the property- Returns:
- true if the property value was actually changed, false otherwise
-
deleteProperty
public boolean deleteProperty(@NotNull PropertyKey propertyKey)Description copied from interface:SPropertyHolderDeletes a property with specified key.- Specified by:
deletePropertyin interfaceSPropertyHolder- Parameters:
propertyKey- property key- Returns:
- true if the property was actually deleted, false otherwise
-
setGroupProperties
public void setGroupProperties(@NotNull Map<? extends PropertyKey,String> properties) throws UserGroupExceptionDescription copied from interface:SUserGroupUpdates properties of this group. Only those properties will be updated which keys are specified in the properties map. All other properties will be left intact.- Specified by:
setGroupPropertiesin interfaceSUserGroup- Parameters:
properties- properties- Throws:
UserGroupException- if specified group no longer exists
-
setGroupProperty
public void setGroupProperty(@NotNull PropertyKey propertyKey, String value) throws UserGroupExceptionDescription copied from interface:SUserGroupSets a property with specified key and value in this group.- Specified by:
setGroupPropertyin interfaceSUserGroup- Parameters:
propertyKey- property keyvalue- value of the property- Throws:
UserGroupException- if specified group no longer exists
-
deleteGroupProperty
public void deleteGroupProperty(@NotNull PropertyKey propertyKey) throws UserGroupExceptionDescription copied from interface:SUserGroupDeletes a property with specified key from this group.- Specified by:
deleteGroupPropertyin interfaceSUserGroup- Parameters:
propertyKey- property key- Throws:
UserGroupException- if specified group no longer exists
-
getRolesWithScope
@NotNull public Collection<Role> getRolesWithScope(@NotNull RoleScope scope)
Permissions.- 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
-
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
-
getParentHolders
@NotNull public 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
-
isPermissionGrantedGlobally
public boolean isPermissionGrantedGlobally(@NotNull Permission permission)Authority.- Specified by:
isPermissionGrantedGloballyin interfaceAuthorityHolder- Parameters:
permission- permission to check- Returns:
- true or false
-
getGlobalPermissions
@NotNull public Permissions getGlobalPermissions()
Description copied from interface:AuthorityHolderReturns all granted non-project related permissions and all project-related permissions granted globally- Specified by:
getGlobalPermissionsin interfaceAuthorityHolder- Returns:
- see above
-
getProjectsPermissions
@NotNull public Map<String,Permissions> getProjectsPermissions()
Description copied from interface:AuthorityHolderReturns map of project-related permissions that were granted for a particular project. Project internal id is used as the key.- Specified by:
getProjectsPermissionsin interfaceAuthorityHolder- Returns:
- map of project permissions
-
isPermissionGrantedForProject
public boolean isPermissionGrantedForProject(@NotNull String projectId, @NotNull Permission permission)Description copied from interface:AuthorityHolderReturns true if permission is granted for a project, i.e. the result is true if there is a project related permission granted globally or for specified project- Specified by:
isPermissionGrantedForProjectin interfaceAuthorityHolder- Parameters:
projectId- project internal idpermission- permission to check- Returns:
- see above
-
isPermissionGrantedForAllProjects
public boolean isPermissionGrantedForAllProjects(@NotNull Collection<String> projectIds, @NotNull Permission permission)Description copied from interface:AuthorityHolderReturns true if permission is granted for all projects from the given list. Returns false if projectIds is empty.- Specified by:
isPermissionGrantedForAllProjectsin interfaceAuthorityHolder- Parameters:
projectIds- collection of project idspermission- permission to check @return see above- See Also:
AuthorityHolder.isPermissionGrantedForProject(java.lang.String, jetbrains.buildServer.serverSide.auth.Permission)
-
isPermissionGrantedForAnyProject
public boolean isPermissionGrantedForAnyProject(@NotNull Permission permission)Description copied from interface:AuthorityHolderReturns true if specified permission is granted for at least one project- Specified by:
isPermissionGrantedForAnyProjectin interfaceAuthorityHolder- Parameters:
permission- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyOfProjects
public boolean isPermissionGrantedForAnyOfProjects(@NotNull Collection<String> projectIds, @NotNull Permission permission)Description copied from interface:AuthorityHolderReturns true if specified permission is granted for at least one project from the given collection- Specified by:
isPermissionGrantedForAnyOfProjectsin interfaceAuthorityHolderpermission- permission to check- Returns:
- see above
-
getPermissionsGrantedForProject
@NotNull public Permissions getPermissionsGrantedForProject(@NotNull String projectId)
Description copied from interface:AuthorityHolderReturns all permissions granted for particular project. These include permissions granted specifically for the specified project and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()).- Specified by:
getPermissionsGrantedForProjectin interfaceAuthorityHolder- Parameters:
projectId- project internal id- Returns:
- all granted permissions for particular project
-
getPermissionsGrantedForAllProjects
@NotNull public Permissions getPermissionsGrantedForAllProjects(@NotNull Collection<String> projectIds)
Description copied from interface:AuthorityHolderReturns all permissions granted for all projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()).- Specified by:
getPermissionsGrantedForAllProjectsin interfaceAuthorityHolder- Parameters:
projectIds- collection of project internal ids- Returns:
- all granted permissions for all projects
-
getPermissionsGrantedForAnyOfProjects
@NotNull public Permissions getPermissionsGrantedForAnyOfProjects(@NotNull Collection<String> projectIds)
Description copied from interface:AuthorityHolderReturns union of permissions granted for projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project associationPermission.isProjectAssociationSupported()).- Specified by:
getPermissionsGrantedForAnyOfProjectsin interfaceAuthorityHolder- Parameters:
projectIds- collection of project internal ids- Returns:
- all granted permissions for all projects
-
getAssociatedUser
@Nullable public User getAssociatedUser()
Description copied from interface:AuthorityHolderReturns the user object associated with the principal.- Specified by:
getAssociatedUserin interfaceAuthorityHolder- Returns:
- may be null if the authority holder is not a user.
-
hasAllPermissionsOf
public boolean hasAllPermissionsOf(@NotNull AuthorityHolder authorityHolder)Description copied from interface:AuthorityHolderReturns true if this authority holder has all permissions of another authority holder.- Specified by:
hasAllPermissionsOfin interfaceAuthorityHolder- Returns:
- see above
-
calculatePermissions
public void calculatePermissions(@NotNull BitSet globalPerms, @NotNull Map<String,Permissions> projectPerms)Description copied from interface:UserGroupExCalculates the permissions of this user group and fillsglobalPermsandprojectPermswith results.- Specified by:
calculatePermissionsin interfaceUserGroupEx- Parameters:
globalPerms- will contain global permissionsprojectPerms- will contain project permissions
-
isAllUsersGroup
public boolean isAllUsersGroup()
Description copied from interface:UserGroupExReturns true, if the specified group is the all-users group.- Specified by:
isAllUsersGroupin interfaceUserGroupEx- Returns:
- true if the specified group is the all-users group, false otherwise
-
updateInfo
public void updateInfo()
Description copied from interface:UserGroupExReload main group info (name and description) from the database- Specified by:
updateInfoin interfaceUserGroupEx
-
updateProperties
public void updateProperties()
Description copied from interface:UserGroupExReload group properties from the database- Specified by:
updatePropertiesin interfaceUserGroupEx
-
updateUsers
public void updateUsers()
Description copied from interface:UserGroupExReload group users from the database- Specified by:
updateUsersin interfaceUserGroupEx
-
updateRoles
public void updateRoles()
Description copied from interface:UserGroupExReload group roles from the database- Specified by:
updateRolesin interfaceUserGroupEx
-
updateSubgroups
public void updateSubgroups()
Description copied from interface:UserGroupExReload group direct subgroups from the database- Specified by:
updateSubgroupsin interfaceUserGroupEx
-
resetRoles
public void resetRoles()
Description copied from interface:UserGroupExResets internal roles cache- Specified by:
resetRolesin interfaceUserGroupEx
-
getNotificationRules
@NotNull public List<NotificationRule> getNotificationRules(@NotNull String notifierType)
Notification rules.- Specified by:
getNotificationRulesin interfaceNotificationRulesHolder- Parameters:
notifierType- type of the notifier- Returns:
- list of notification rules for specified notifier
-
setNotificationRules
public void setNotificationRules(@NotNull String notifierType, @NotNull List<NotificationRule> rules)Description copied from interface:NotificationRulesHolderSets the notification rules for specified notifier.- Specified by:
setNotificationRulesin interfaceNotificationRulesHolder- Parameters:
notifierType- type of the notifierrules- rules to save
-
removeRule
public void removeRule(long ruleId)
Description copied from interface:NotificationRulesHolderRemoves the rule with specified id.- Specified by:
removeRulein interfaceNotificationRulesHolder- Parameters:
ruleId- id of the rule
-
removeRule
public void removeRule(@NotNull NotificationRule rule)Description copied from interface:NotificationRulesHolderRemoves the rule. ThrowsNotificationRuleChangedExceptionif notification rule with same id was already changed. Does nothing if notification rule doesn't exist.- Specified by:
removeRulein interfaceNotificationRulesHolder- Parameters:
rule- rule to remove
-
applyOrder
public void applyOrder(@NotNull String notifierType, @NotNull long[] ruleIds)Description copied from interface:NotificationRulesHolderSorts the notification rules in the specified order.- Specified by:
applyOrderin interfaceNotificationRulesHolder- Parameters:
notifierType- type of the notifierruleIds- ids of the rules in the required order
-
addNewRule
public long addNewRule(@NotNull String notifierType, @NotNull NotificationRule rule) throws DuplicateNotificationRuleExceptionDescription copied from interface:NotificationRulesHolderAdds new rule to the rules of specified user for specified notifier type.- Specified by:
addNewRulein interfaceNotificationRulesHolder- Parameters:
notifierType- type of the notifierrule- rule to add- Returns:
- the id of the newly created rule
- Throws:
DuplicateNotificationRuleException- if similar rule already exists
-
findConflictingRules
public Collection<Long> findConflictingRules(@NotNull String notifierType, @NotNull WatchedBuilds watch)
Description copied from interface:NotificationRulesHolderSearches for rules which intersect with specified watched builds.- Specified by:
findConflictingRulesin interfaceNotificationRulesHolder- Parameters:
notifierType- type of the notifierwatch- watched builds- Returns:
- list of conflicting rules ids
-
findRuleById
public NotificationRule findRuleById(long ruleId)
Description copied from interface:NotificationRulesHolderSearches for a rule with specified id.- Specified by:
findRuleByIdin interfaceNotificationRulesHolder- Parameters:
ruleId- id of the rule- Returns:
- a found rule, or null
-
getParentRulesHolders
@NotNull public List<NotificationRulesHolder> getParentRulesHolders()
Description copied from interface:NotificationRulesHolderReturns direct parent notification rules holders- Specified by:
getParentRulesHoldersin interfaceNotificationRulesHolder- Returns:
- direct parent notification rules holders
-
dispose
public void dispose()
Other.- Specified by:
disposein interfaceUserGroupEx
-
getAllPermissions
@NotNull public Pair<Permissions,Map<String,Permissions>> getAllPermissions()
Description copied from interface:AuthorityHolderReturns both global and project permissions at once.- Specified by:
getAllPermissionsin interfaceAuthorityHolder- Returns:
- a pair of global and project permissions.
-
describe
@NotNull public String describe(boolean verbose)
-
getAllParentRulesHolders
@NotNull public List<NotificationRulesHolder> getAllParentRulesHolders()
Description copied from interface:NotificationRulesHolderReturns all (direct and inherited) parent notification rules holders- Specified by:
getAllParentRulesHoldersin interfaceNotificationRulesHolder- Returns:
- all (direct and inherited) parent notification rules holders
-
cleanupGroup
public void cleanupGroup()
Description copied from interface:UserGroupExRemoves from the group users, which were removed on the server- Specified by:
cleanupGroupin interfaceUserGroupEx
-
-