Class SecuredUserGroup
- java.lang.Object
-
- jetbrains.buildServer.groups.impl.SecuredUserGroup
-
- All Implemented Interfaces:
Comparable<UserGroup>
,SUserGroup
,UserGroup
,UserGroupEx
,Loggable
,NotificationRulesHolder
,AuthorityHolder
,RolesHolder
,RolesHolderEx
,PropertyHolder
,SPropertyHolder
public class SecuredUserGroup extends Object implements UserGroupEx
- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Constructor Summary
Constructors Constructor Description SecuredUserGroup(SecurityContextEx securityContext, UserGroupEx delegate, ProjectManagerEx projectManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
addNewRule(String notifierType, NotificationRule rule)
Adds new rule to the rules of specified user for specified notifier type.void
addParent(UserGroup parent)
Adds the parent group.void
addRole(RoleScope scope, Role role)
Adds role with specified scopevoid
addSubgroup(UserGroup group)
Adds a subgroup to this group.void
addSubgroups(Collection<UserGroup> subgroups)
Adds a set of subgroups atomicly.void
addUser(User user)
Adds a user to this group.void
applyOrder(String notifierType, long[] ruleIds)
Sorts the notification rules in the specified order.void
calculatePermissions(BitSet globalPerms, Map<String,Permissions> projectPerms)
Calculates the permissions of this user group and fillsglobalPerms
andprojectPerms
with results.void
cleanupGroup()
Removes from the group users, which were removed on the serverint
compareTo(UserGroup o)
boolean
containsUserDirectly(User user)
void
deleteGroupProperty(PropertyKey propertyKey)
Deletes a property with specified key from this group.boolean
deleteProperty(PropertyKey propertyKey)
Deletes a property with specified key.String
describe(boolean verbose)
void
dispose()
Removes all users, subgroups, etc from the group (and from DB).Collection<Long>
findConflictingRules(String notifierType, WatchedBuilds watch)
Searches for rules which intersect with specified watched builds.NotificationRule
findRuleById(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 holdersList<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.User
getAssociatedUser()
Returns the user object associated with the principal.boolean
getBooleanProperty(PropertyKey propertyKey)
Returns value of the boolean propertyString
getDescription()
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.Permissions
getGlobalPermissions()
Returns all granted non-project related permissions and all project-related permissions granted globallyString
getKey()
Returns a group key.String
getName()
Returns a displayable name of this group.List<NotificationRule>
getNotificationRules(String notifierType)
Returns the notification rules for specified notifier for this holder (user or group).List<UserGroup>
getParentGroups()
Returns the list of direct parent groups, i.e.Collection<RolesHolder>
getParentHolders()
Returns direct (non transitive) parent holders.List<NotificationRulesHolder>
getParentRulesHolders()
Returns direct parent notification rules holdersPermissions
getPermissionsGrantedForAllProjects(Collection<String> projectIds)
Returns all permissions granted for all projects from the collection.Permissions
getPermissionsGrantedForAnyOfProjects(Collection<String> projectIds)
Returns union of permissions granted for projects from the collection.Permissions
getPermissionsGrantedForProject(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 propertiesString
getPropertyValue(PropertyKey propertyKey)
Returns value of the property with specified keyCollection<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()
int
getUsersNumber()
Returns the number of (direct) users in this group.boolean
hasAllPermissionsOf(AuthorityHolder authorityHolder)
Returns true if this authority holder has all permissions of another authority holder.boolean
hasParents()
Returns whether this group has parent groups.boolean
isAllUsersGroup()
Returns true, if the specified group is the all-users group.boolean
isPermissionGrantedForAllProjects(Collection<String> projectIds, Permission permission)
Returns true if permission is granted for all projects from the given list.boolean
isPermissionGrantedForAnyOfProjects(Collection<String> projectIds, Permission permission)
Returns true if specified permission is granted for at least one project from the given collectionboolean
isPermissionGrantedForAnyProject(Permission permission)
Returns true if specified permission is granted for at least one projectboolean
isPermissionGrantedForProject(String projectId, Permission permission)
Returns true if permission is granted for a project, i.e.boolean
isPermissionGrantedGlobally(Permission permission)
Returns true if specified permission granted globally (i.e.boolean
isSystemAdministratorRoleGranted()
Returns true if this roles holder contains system administrator role granted directly or inherited via parent holders.boolean
isSystemAdministratorRoleGrantedDirectly()
Returns true if this roles holder contains system administrator role granted directly.boolean
isSystemAdministratorRoleInherited()
Returns true if one of the parents (transitively) of this roles holder contains system administrator role.void
removeParent(UserGroup parent)
Removes the parent group.void
removeRole(Role role)
Removes specified role.void
removeRole(RoleScope scope, Role role)
Removes role with specified scopevoid
removeRoles(RoleScope scope)
Removes all of the roles having the specified scope.void
removeRule(long ruleId)
Removes the rule with specified id.void
removeRule(NotificationRule rule)
Removes the rule.void
removeSubgroup(UserGroup group)
Removes a direct subgroup.void
removeUser(User user)
Removes a user from this group.void
resetRoles()
Resets internal roles cachevoid
setDescription(String description)
Sets the group description.void
setGroupProperties(Map<? extends PropertyKey,String> properties)
Updates properties of this group.void
setGroupProperty(PropertyKey propertyKey, String value)
Sets a property with specified key and value in this group.void
setName(String name)
Sets the group name.void
setNotificationRules(String notifierType, List<NotificationRule> rules)
Sets the notification rules for specified notifier.boolean
setProperties(Map<? extends PropertyKey,String> properties)
Updates the specified properties.boolean
setProperty(PropertyKey propertyKey, String value)
Sets a property with specified key and value.String
toString()
void
updateInfo()
Reload main group info (name and description) from the databasevoid
updateProperties()
Reload group properties from the databasevoid
updateRoles()
Reload group roles from the databasevoid
updateSubgroups()
Reload group direct subgroups from the databasevoid
updateUsers()
Reload group users from the database-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.auth.AuthorityHolder
getAllPermissions
-
-
-
-
Constructor Detail
-
SecuredUserGroup
public SecuredUserGroup(@NotNull SecurityContextEx securityContext, @NotNull UserGroupEx delegate, @NotNull ProjectManagerEx projectManager)
-
-
Method Detail
-
getKey
@NotNull public String getKey()
Description copied from interface:UserGroup
Returns a group key. The key is fixed, unique among all groups.
-
getName
@NotNull public String getName()
Description copied from interface:UserGroup
Returns 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 UserGroupException
Description copied from interface:SUserGroup
Sets the group name.Note: group name must be unique among all user groups. If
name
already exists, an exception is thrown.The name cannot be empty and cannot exceed 255 characters.
- Specified by:
setName
in interfaceSUserGroup
- Parameters:
name
- the new group name- Throws:
UserGroupException
- if name already exists, or is empty, or is too long- See Also:
UserGroup.getName()
-
getDescription
@NotNull public String getDescription()
Description copied from interface:UserGroup
Returns a description of this group.- Specified by:
getDescription
in interfaceUserGroup
- Returns:
- group description
-
setDescription
public void setDescription(@NotNull String description) throws UserGroupException
Description copied from interface:SUserGroup
Sets the group description.The description cannot exceed 2000 characters.
- Specified by:
setDescription
in interfaceSUserGroup
- Parameters:
description
- the new description- Throws:
UserGroupException
- if description is too long- See Also:
UserGroup.getDescription()
-
addSubgroup
public void addSubgroup(@NotNull UserGroup group) throws UserGroupException
Description copied from interface:SUserGroup
Adds a subgroup to this group. Does nothing if the subgroup is already included directly.User group cycles by inclusion are not permitted. An attempt to create a cycle results in exception.
- Specified by:
addSubgroup
in 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 UserGroupException
Description copied from interface:UserGroupEx
Adds a set of subgroups atomicly. The same rules as inSUserGroup.addSubgroup(UserGroup)
apply.- Specified by:
addSubgroups
in interfaceUserGroupEx
- Parameters:
subgroups
- the subgroups to be added- Throws:
UserGroupException
- in case of error (seeSUserGroup.addSubgroup(UserGroup)
)
-
removeSubgroup
public void removeSubgroup(@NotNull UserGroup group)
Description copied from interface:SUserGroup
Removes a direct subgroup. Does nothing if the subgroup is included indirectly.- Specified by:
removeSubgroup
in interfaceSUserGroup
- Parameters:
group
- a subgroup to remove
-
getDirectSubgroups
@NotNull public List<UserGroup> getDirectSubgroups()
Description copied from interface:UserGroup
Returns the collection of subgroups that are directly included into this group.- Specified by:
getDirectSubgroups
in interfaceUserGroup
- Returns:
- list of direct subgroups
- See Also:
UserGroup.getAllSubgroups()
,UserGroup.getParentGroups()
-
getAllSubgroups
@NotNull public List<UserGroup> getAllSubgroups()
Description copied from interface:UserGroup
Returns the set of all subgroups included into this group, directly or through intermediate ones.- Specified by:
getAllSubgroups
in interfaceUserGroup
- Returns:
- list of all subgroups
- See Also:
UserGroup.getDirectSubgroups()
-
getParentGroups
@NotNull public List<UserGroup> getParentGroups()
Description copied from interface:UserGroup
Returns the list of direct parent groups, i.e. groups that contain this groups as a subgroup.- Specified by:
getParentGroups
in interfaceUserGroup
- Returns:
- list of direct parents
- See Also:
UserGroup.getDirectSubgroups()
-
addParent
public void addParent(@NotNull UserGroup parent)
Description copied from interface:UserGroupEx
Adds the parent group.Do not call this method directly! It should be consistent with
addSubgroup
.- Specified by:
addParent
in interfaceUserGroupEx
- Parameters:
parent
- the parent to add
-
removeParent
public void removeParent(@NotNull UserGroup parent)
Description copied from interface:UserGroupEx
Removes the parent group.Do not call this method directly! It should be consistent with
removeSubgroup
.- Specified by:
removeParent
in interfaceUserGroupEx
- Parameters:
parent
- the parent to remove
-
hasParents
public boolean hasParents()
Description copied from interface:UserGroupEx
Returns whether this group has parent groups. Using this method is faster than!getParentGroups().isEmpty()
- Specified by:
hasParents
in interfaceUserGroupEx
- Returns:
- true if this group has parent groups
-
addUser
public void addUser(@NotNull User user)
Description copied from interface:SUserGroup
Adds a user to this group. Does nothing if the user is already included into this group directly.- Specified by:
addUser
in interfaceSUserGroup
- Parameters:
user
- the user to add
-
removeUser
public void removeUser(@NotNull User user) throws UserGroupException
Description copied from interface:SUserGroup
Removes 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:
removeUser
in interfaceSUserGroup
- Parameters:
user
- a user to remove- Throws:
UserGroupException
- if user is the authority holder, trying to remove himself
-
getUsersNumber
public int getUsersNumber()
Description copied from interface:UserGroupEx
Returns the number of (direct) users in this group. Much more effective thangetDirectUsers().size()
.- Specified by:
getUsersNumber
in interfaceUserGroupEx
- Returns:
- the number of users in the group
-
getDirectUsers
@NotNull public List<User> getDirectUsers()
Description copied from interface:UserGroup
Returns the collection of users included into this group. This method ignores the subgroups.- Specified by:
getDirectUsers
in interfaceUserGroup
- Returns:
- list of users
- See Also:
UserGroup.getAllUsers()
-
getAllUsers
@NotNull public List<User> getAllUsers()
Description copied from interface:UserGroup
Returns the set of all users included into this group, directly or through subgroups.- Specified by:
getAllUsers
in interfaceUserGroup
- Returns:
- list of all users
- See Also:
UserGroup.getDirectUsers()
-
containsUserDirectly
public boolean containsUserDirectly(@NotNull User user)
- Specified by:
containsUserDirectly
in interfaceUserGroup
- Parameters:
user
- user to check- Returns:
- true if this group contains user directly (user is returned by getDirectUsers)
-
getPropertyValue
@Nullable public String getPropertyValue(PropertyKey propertyKey)
Description copied from interface:PropertyHolder
Returns value of the property with specified key- Specified by:
getPropertyValue
in 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:PropertyHolder
Returns value of the boolean property- Specified by:
getBooleanProperty
in interfacePropertyHolder
- Parameters:
propertyKey
- property key- Returns:
- value
-
getProperties
@NotNull public Map<PropertyKey,String> getProperties()
Description copied from interface:PropertyHolder
Returns map of the properties- Specified by:
getProperties
in interfacePropertyHolder
- Returns:
- map of the properties
-
setProperties
public boolean setProperties(@NotNull Map<? extends PropertyKey,String> properties)
Description copied from interface:SPropertyHolder
Updates 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:
setProperties
in 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:SPropertyHolder
Sets a property with specified key and value.- Specified by:
setProperty
in 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:SPropertyHolder
Deletes a property with specified key.- Specified by:
deleteProperty
in 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 UserGroupException
Description copied from interface:SUserGroup
Updates 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:
setGroupProperties
in interfaceSUserGroup
- Parameters:
properties
- properties- Throws:
UserGroupException
- if specified group no longer exists
-
setGroupProperty
public void setGroupProperty(@NotNull PropertyKey propertyKey, String value) throws UserGroupException
Description copied from interface:SUserGroup
Sets a property with specified key and value in this group.- Specified by:
setGroupProperty
in 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 UserGroupException
Description copied from interface:SUserGroup
Deletes a property with specified key from this group.- Specified by:
deleteGroupProperty
in interfaceSUserGroup
- Parameters:
propertyKey
- property key- Throws:
UserGroupException
- if specified group no longer exists
-
getRolesWithScope
@NotNull public Collection<Role> getRolesWithScope(@NotNull RoleScope scope)
Description copied from interface:RolesHolder
Returns all roles with specified scope.- Specified by:
getRolesWithScope
in interfaceRolesHolder
- Parameters:
scope
- roles scope- Returns:
- all roles with specified scope.
-
getScopes
public Collection<RoleScope> getScopes()
Description copied from interface:RolesHolder
Returns all scopes with assigned roles- Specified by:
getScopes
in interfaceRolesHolder
- Returns:
- all scopes with assigned roles
-
getUnfilteredScopes
@NotNull public Collection<RoleScope> getUnfilteredScopes()
- Specified by:
getUnfilteredScopes
in 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:
getUnfilteredRoles
in 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:RolesHolder
Returns roles with their scopes- Specified by:
getRoles
in interfaceRolesHolder
- Returns:
- roles with their scopes
-
addRole
public void addRole(@NotNull RoleScope scope, @NotNull Role role)
Description copied from interface:RolesHolder
Adds role with specified scope- Specified by:
addRole
in interfaceRolesHolder
- Parameters:
scope
- scope of the rolerole
- role
-
removeRole
public void removeRole(@NotNull RoleScope scope, @NotNull Role role)
Description copied from interface:RolesHolder
Removes role with specified scope- Specified by:
removeRole
in interfaceRolesHolder
- Parameters:
scope
- scope of the rolerole
- role
-
removeRole
public void removeRole(@NotNull Role role)
Description copied from interface:RolesHolder
Removes specified role. If the role is associated with several scopes all of these roles will be removed.- Specified by:
removeRole
in interfaceRolesHolder
- Parameters:
role
- role to remove
-
removeRoles
public void removeRoles(@NotNull RoleScope scope)
Description copied from interface:RolesHolder
Removes all of the roles having the specified scope.- Specified by:
removeRoles
in interfaceRolesHolder
- Parameters:
scope
- scope of the role
-
isSystemAdministratorRoleGranted
public boolean isSystemAdministratorRoleGranted()
Description copied from interface:RolesHolder
Returns true if this roles holder contains system administrator role granted directly or inherited via parent holders. Same as:isSystemAdministratorRoleGrantedDirectly() || isSystemAdministratorRoleInherited()
- Specified by:
isSystemAdministratorRoleGranted
in interfaceRolesHolder
- Returns:
- see above.
-
isSystemAdministratorRoleGrantedDirectly
public boolean isSystemAdministratorRoleGrantedDirectly()
Description copied from interface:RolesHolder
Returns true if this roles holder contains system administrator role granted directly.- Specified by:
isSystemAdministratorRoleGrantedDirectly
in interfaceRolesHolder
- Returns:
- see above.
-
isSystemAdministratorRoleInherited
public boolean isSystemAdministratorRoleInherited()
Description copied from interface:RolesHolder
Returns true if one of the parents (transitively) of this roles holder contains system administrator role.- Specified by:
isSystemAdministratorRoleInherited
in interfaceRolesHolder
- Returns:
- see above
-
getParentHolders
@NotNull public Collection<RolesHolder> getParentHolders()
Description copied from interface:RolesHolder
Returns direct (non transitive) parent holders.- Specified by:
getParentHolders
in interfaceRolesHolder
- Returns:
- parent holders
-
getAllParentHolders
@NotNull public Collection<RolesHolder> getAllParentHolders()
Description copied from interface:RolesHolder
Returns all parent holders including transitive ones- Specified by:
getAllParentHolders
in interfaceRolesHolder
- Returns:
- all parent holders
-
calculatePermissions
public void calculatePermissions(@NotNull BitSet globalPerms, @NotNull Map<String,Permissions> projectPerms)
Description copied from interface:UserGroupEx
Calculates the permissions of this user group and fillsglobalPerms
andprojectPerms
with results.- Specified by:
calculatePermissions
in interfaceUserGroupEx
- Parameters:
globalPerms
- will contain global permissionsprojectPerms
- will contain project permissions
-
isAllUsersGroup
public boolean isAllUsersGroup()
Description copied from interface:UserGroupEx
Returns true, if the specified group is the all-users group.- Specified by:
isAllUsersGroup
in interfaceUserGroupEx
- Returns:
- true if the specified group is the all-users group, false otherwise
-
updateInfo
public void updateInfo()
Description copied from interface:UserGroupEx
Reload main group info (name and description) from the database- Specified by:
updateInfo
in interfaceUserGroupEx
-
updateProperties
public void updateProperties()
Description copied from interface:UserGroupEx
Reload group properties from the database- Specified by:
updateProperties
in interfaceUserGroupEx
-
updateUsers
public void updateUsers()
Description copied from interface:UserGroupEx
Reload group users from the database- Specified by:
updateUsers
in interfaceUserGroupEx
-
updateRoles
public void updateRoles()
Description copied from interface:UserGroupEx
Reload group roles from the database- Specified by:
updateRoles
in interfaceUserGroupEx
-
updateSubgroups
public void updateSubgroups()
Description copied from interface:UserGroupEx
Reload group direct subgroups from the database- Specified by:
updateSubgroups
in interfaceUserGroupEx
-
resetRoles
public void resetRoles()
Description copied from interface:UserGroupEx
Resets internal roles cache- Specified by:
resetRoles
in interfaceUserGroupEx
-
isPermissionGrantedGlobally
public boolean isPermissionGrantedGlobally(@NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if specified permission granted globally (i.e. not associated with any particular object)- Specified by:
isPermissionGrantedGlobally
in interfaceAuthorityHolder
- Parameters:
permission
- permission to check- Returns:
- true or false
-
getGlobalPermissions
@NotNull public Permissions getGlobalPermissions()
Description copied from interface:AuthorityHolder
Returns all granted non-project related permissions and all project-related permissions granted globally- Specified by:
getGlobalPermissions
in interfaceAuthorityHolder
- Returns:
- see above
-
getProjectsPermissions
@NotNull public Map<String,Permissions> getProjectsPermissions()
Description copied from interface:AuthorityHolder
Returns map of project-related permissions that were granted for a particular project. Project internal id is used as the key.- Specified by:
getProjectsPermissions
in interfaceAuthorityHolder
- Returns:
- map of project permissions
-
isPermissionGrantedForProject
public boolean isPermissionGrantedForProject(@NotNull String projectId, @NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns 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:
isPermissionGrantedForProject
in 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:AuthorityHolder
Returns true if permission is granted for all projects from the given list. Returns false if projectIds is empty.- Specified by:
isPermissionGrantedForAllProjects
in 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:AuthorityHolder
Returns true if specified permission is granted for at least one project- Specified by:
isPermissionGrantedForAnyProject
in interfaceAuthorityHolder
- Parameters:
permission
- permission to check- Returns:
- see above
-
isPermissionGrantedForAnyOfProjects
public boolean isPermissionGrantedForAnyOfProjects(@NotNull Collection<String> projectIds, @NotNull Permission permission)
Description copied from interface:AuthorityHolder
Returns true if specified permission is granted for at least one project from the given collection- Specified by:
isPermissionGrantedForAnyOfProjects
in interfaceAuthorityHolder
permission
- permission to check- Returns:
- see above
-
getPermissionsGrantedForProject
@NotNull public Permissions getPermissionsGrantedForProject(@NotNull String projectId)
Description copied from interface:AuthorityHolder
Returns 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:
getPermissionsGrantedForProject
in 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:AuthorityHolder
Returns 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:
getPermissionsGrantedForAllProjects
in 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:AuthorityHolder
Returns 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:
getPermissionsGrantedForAnyOfProjects
in interfaceAuthorityHolder
- Parameters:
projectIds
- collection of project internal ids- Returns:
- all granted permissions for all projects
-
getAssociatedUser
public User getAssociatedUser()
Description copied from interface:AuthorityHolder
Returns the user object associated with the principal.- Specified by:
getAssociatedUser
in interfaceAuthorityHolder
- Returns:
- may be null if the authority holder is not a user.
-
hasAllPermissionsOf
public boolean hasAllPermissionsOf(@NotNull AuthorityHolder authorityHolder)
Description copied from interface:AuthorityHolder
Returns true if this authority holder has all permissions of another authority holder.- Specified by:
hasAllPermissionsOf
in interfaceAuthorityHolder
- Returns:
- see above
-
getNotificationRules
@NotNull public List<NotificationRule> getNotificationRules(@NotNull String notifierType)
Description copied from interface:NotificationRulesHolder
Returns the notification rules for specified notifier for this holder (user or group).- Specified by:
getNotificationRules
in 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:NotificationRulesHolder
Sets the notification rules for specified notifier.- Specified by:
setNotificationRules
in interfaceNotificationRulesHolder
- Parameters:
notifierType
- type of the notifierrules
- rules to save
-
removeRule
public void removeRule(long ruleId)
Description copied from interface:NotificationRulesHolder
Removes the rule with specified id.- Specified by:
removeRule
in interfaceNotificationRulesHolder
- Parameters:
ruleId
- id of the rule
-
removeRule
public void removeRule(@NotNull NotificationRule rule)
Description copied from interface:NotificationRulesHolder
Removes the rule. ThrowsNotificationRuleChangedException
if notification rule with same id was already changed. Does nothing if notification rule doesn't exist.- Specified by:
removeRule
in interfaceNotificationRulesHolder
- Parameters:
rule
- rule to remove
-
applyOrder
public void applyOrder(@NotNull String notifierType, @NotNull long[] ruleIds)
Description copied from interface:NotificationRulesHolder
Sorts the notification rules in the specified order.- Specified by:
applyOrder
in 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 DuplicateNotificationRuleException
Description copied from interface:NotificationRulesHolder
Adds new rule to the rules of specified user for specified notifier type.- Specified by:
addNewRule
in 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:NotificationRulesHolder
Searches for rules which intersect with specified watched builds.- Specified by:
findConflictingRules
in 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:NotificationRulesHolder
Searches for a rule with specified id.- Specified by:
findRuleById
in interfaceNotificationRulesHolder
- Parameters:
ruleId
- id of the rule- Returns:
- a found rule, or null
-
getParentRulesHolders
@NotNull public List<NotificationRulesHolder> getParentRulesHolders()
Description copied from interface:NotificationRulesHolder
Returns direct parent notification rules holders- Specified by:
getParentRulesHolders
in interfaceNotificationRulesHolder
- Returns:
- direct parent notification rules holders
-
getAllParentRulesHolders
@NotNull public List<NotificationRulesHolder> getAllParentRulesHolders()
Description copied from interface:NotificationRulesHolder
Returns all (direct and inherited) parent notification rules holders- Specified by:
getAllParentRulesHolders
in interfaceNotificationRulesHolder
- Returns:
- all (direct and inherited) parent notification rules holders
-
dispose
public void dispose()
Description copied from interface:UserGroupEx
Removes all users, subgroups, etc from the group (and from DB).Useful when the group is deleted.
- Specified by:
dispose
in interfaceUserGroupEx
-
compareTo
public int compareTo(UserGroup o)
- Specified by:
compareTo
in interfaceComparable<UserGroup>
-
describe
@NotNull public String describe(boolean verbose)
-
cleanupGroup
public void cleanupGroup()
Description copied from interface:UserGroupEx
Removes from the group users, which were removed on the server- Specified by:
cleanupGroup
in interfaceUserGroupEx
-
-