Class InMemoryUser
- java.lang.Object
-
- jetbrains.buildServer.controllers.login.InMemoryUser
-
- All Implemented Interfaces:
Loggable
,NotificationRulesHolder
,AuthorityHolder
,RolesHolder
,UserEx
,UserRolesInit
,PropertyHolder
,SPropertyHolder
,SUser
,User
public class InMemoryUser extends Object implements UserEx
Original GuestUser or RootUser throws exception on attempt to change its profile (because there is no such thing as profile for guest user). However in the web interface you often need to show information based on current user settings. That is why this object is used in web interfaces instead of original guest user. The settings of this object are not persisted, they disappear once the user logs out. Also this wrapper is used in read only mode.
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.users.SUser
GUEST_USER_ID, SUPER_USER_ID, UKNOWN_USER_ID
-
-
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
addRole(RoleScope scope, Role role)
Adds role with specified scopevoid
addVcsUsername(VcsUsernamePropertyKey key, String userName)
void
applyOrder(String notifierType, long[] ruleIds)
Sorts the notification rules in the specified order.void
deleteAttribute(String attributeKey)
Delete user attributeboolean
deleteProperty(PropertyKey propertyKey)
Deletes a property with specified key.void
deleteUserProperty(PropertyKey propertyKey)
Deletes a property with specified key from the user profile.String
describe(boolean verbose)
boolean
equals(Object obj)
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.List<SVcsModification>
getAllModifications()
Returns the list of all (personal and non-personal) user modifications sorted by VCS date.Collection<RolesHolder>
getAllParentHolders()
Returns all parent holders including transitive onesList<NotificationRulesHolder>
getAllParentRulesHolders()
Returns all (direct and inherited) parent notification rules holdersList<String>
getAllProjects()
Returns all projects sorted according to the order specified by user.List<UserGroup>
getAllUserGroups()
Returns the list of all user groups that include this user, directly or through intermediate subgroups.User
getAssociatedUser()
Returns the user object associated with the principal.String
getAttribute(String attributeKey)
Get user attributeMap<String,String>
getAttributes()
Get all user attributesString
getBlockState(String blockType)
Retrieves state of a block stored for this userboolean
getBooleanProperty(PropertyKey propertyKey)
Returns value of the boolean propertyCollection<SBuildType>
getBuildTypesOrder(SProject project)
String
getDescriptiveName()
Returns full name of the user if it is not empty, otherwise returns username.String
getEmail()
Returns e-mail of this userString
getExtendedName()
SortedMap<SProject,List<SBuildType>>
getFilteredVisibleBuildTypes(BuildTypeFilter filter)
Returns sorted map of build configurations per project.Permissions
getGlobalPermissions()
Returns all granted non-project related permissions and all project-related permissions granted globallylong
getId()
Returns user idDate
getLastLoginTimestamp()
Returns this user last login timestampString
getName()
Returns full name of this userList<NotificationRule>
getNotificationRules(String notificatorType)
Returns the notification rules for specified notifier for this holder (user or group).List<SBuildType>
getOrderedBuildTypes(SProject project)
Returns the list of build configurations (in a project, or globally) sorted according to user settings.AuthorityHolder
getOriginalAuthorityHolder()
The same asSecurityContextEx.getOriginalAuthority()
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.List<String>
getProjectsOrder()
Map<String,Permissions>
getProjectsPermissions()
Returns map of project-related permissions that were granted for a particular project.ProjectVisibilityHolder
getProjectVisibilityHolder()
Map<PropertyKey,String>
getProperties()
Returns map of the propertiesString
getPropertyValue(PropertyKey propertyKey)
Returns value of the property with specified keyString
getRealm()
Returns realm of the user.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 rolesList<UserGroup>
getUserGroups()
Returns the list of groups which this user belongs to.String
getUsername()
Returns username of this userList<SVcsModification>
getVcsModifications(int numberOfActiveDays)
Returns the list of changes made by this user filtered according to the caller's permissions.List<VcsUsernamePropertyKey>
getVcsUsernameProperties()
Returns list of VCS username properties associated with this user.Map<VcsUsernamePropertyKey,List<String>>
getVcsUsernames()
String
getVerifiedEmail()
Returns null if user doesn't have email specified or his email is not verified.List<String>
getVisibleProjects()
Computes list of visible projects sorted according to the order specified by user.boolean
hasAllPermissionsOf(AuthorityHolder authorityHolder)
Returns true if this authority holder has all permissions of another authority holder.int
hashCode()
boolean
hasPassword()
Returns true if user has password, false otherwise (e.g.void
hideProject(String projectId)
Marks a project with specified id as invisiblevoid
hideProjects(Collection<String> projectIds)
Marks the specified projects as invisiblevoid
init(String username, String name, String email, Long lastLogin, boolean hasPassword)
boolean
isConfiguredVisibleProjects()
Returns whether the user has configured visible projects.boolean
isGuest()
Returns true if the user is guestboolean
isHasHiddenProjects()
Returns whether the user has any hidden (i.e.boolean
isHighlightRelatedDataInUI()
Returns true if highlighting of user changes, investigations, and other related data in web UI is enabled.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
isPseudoUser()
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
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
resetBlocks()
Reset cached blocksvoid
resetBuildTypesOrder(SProject project)
Resets the build types order settings to defaults.void
resetCachedAttributes()
Reset cached user attributesvoid
resetCachedProperties()
Reset cached blocksvoid
resetCachedVcsUsernames()
Reset cached blocksvoid
resetRoles()
Causes roles reloading from the database.<T> T
runWithRestrictor(AuthorityHolderRestrictor restrictor, SecurityContextEx.RunAsActionWithResult<T> action)
void
setAttribute(String attributeKey, String attributeValue)
Set user attributevoid
setBlockState(String blockType, String blockState)
Stores collapsable block state for this uservoid
setBuildTypesOrder(SProject project, List<SBuildType> visible, List<SBuildType> invisible)
Sets visible and invisible build types for the given project in the specified order.void
setCreationInProgress(boolean inProgress)
void
setDefaultVcsUsernames(List<String> userNames)
boolean
setEmailIsVerified(String email)
Mark user`s email as verified if it's equal to email passed in parameter.void
setLastLoginTimestamp(Date timestamp)
Updates last login timestampvoid
setNotificationRules(String notifierType, List<NotificationRule> rules)
Sets the notification rules for specified notifier.void
setPassword(String password)
Changes password of this uservoid
setProjectsOrder(List<String> projectsOrder)
Sets order of the projects.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.void
setUserProperties(Map<? extends PropertyKey,String> properties)
Updates properties of the user specified by user id.void
setUserProperty(PropertyKey propertyKey, String value)
Sets a property with specified key and value in user profilevoid
setVcsRootUsernames(VcsRoot root, List<String> userNames)
void
setVcsUsernames(String vcsName, List<String> userNames)
void
setVcsUsernames(VcsUsernamePropertyKey key, List<String> userNames)
void
setVisibleProjects(Collection<String> visibleProjects)
Sets projects visible for specified userString
toString()
void
updatePermissions()
Forces this user to recompute its permissions.void
updateUserAccount(String username, String name, String email)
Updates user fields: username, name and email.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.auth.AuthorityHolder
getAllPermissions
-
Methods inherited from interface jetbrains.buildServer.users.impl.UserEx
runWithRestrictor
-
-
-
-
Method Detail
-
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
-
setUserProperties
public void setUserProperties(@NotNull Map<? extends PropertyKey,String> properties) throws UserNotFoundException
Description copied from interface:SUser
Updates properties of the user specified by user id. Only those properties will be updated which keys are specified in the properties map. All other properties will be left intact.- Specified by:
setUserProperties
in interfaceSUser
- Parameters:
properties
- properties- Throws:
UserNotFoundException
- if specified user no longer exists
-
setUserProperty
public void setUserProperty(@NotNull PropertyKey propertyKey, String value) throws UserNotFoundException
Description copied from interface:SUser
Sets a property with specified key and value in user profile- Specified by:
setUserProperty
in interfaceSUser
- Parameters:
propertyKey
- property keyvalue
- value of the property- Throws:
UserNotFoundException
- if specified user no longer exists
-
deleteUserProperty
public void deleteUserProperty(@NotNull PropertyKey propertyKey) throws UserNotFoundException
Description copied from interface:SUser
Deletes a property with specified key from the user profile.- Specified by:
deleteUserProperty
in interfaceSUser
- Parameters:
propertyKey
- property key- Throws:
UserNotFoundException
- if specified user no longer exists
-
getPropertyValue
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
-
setBlockState
public void setBlockState(String blockType, String blockState)
Description copied from interface:SUser
Stores collapsable block state for this user- Specified by:
setBlockState
in interfaceSUser
- Parameters:
blockType
- type of blockblockState
- state
-
getBlockState
public String getBlockState(String blockType)
Description copied from interface:SUser
Retrieves state of a block stored for this user- Specified by:
getBlockState
in interfaceSUser
- Parameters:
blockType
- type of block- Returns:
- block state or null
-
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
-
getVisibleProjects
public List<String> getVisibleProjects()
Description copied from interface:User
Computes list of visible projects sorted according to the order specified by user.- Specified by:
getVisibleProjects
in interfaceUser
- Returns:
- list of visible projects ids
-
getAllProjects
public List<String> getAllProjects()
Description copied from interface:User
Returns all projects sorted according to the order specified by user.- Specified by:
getAllProjects
in interfaceUser
- Returns:
- list of all of the projects ids
-
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)
-
getVcsModifications
@NotNull public List<SVcsModification> getVcsModifications(int numberOfActiveDays)
Description copied from interface:SUser
Returns the list of changes made by this user filtered according to the caller's permissions.- Specified by:
getVcsModifications
in interfaceSUser
- Parameters:
numberOfActiveDays
- number of last active days of changing- Returns:
- unmodifiable list of user changes
-
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
-
getAllModifications
@NotNull public List<SVcsModification> getAllModifications()
Description copied from interface:SUser
Returns the list of all (personal and non-personal) user modifications sorted by VCS date. Returns only modifications which have at least one related configuration.- Specified by:
getAllModifications
in interfaceSUser
- Returns:
- see above
-
updateUserAccount
public void updateUserAccount(@NotNull String username, String name, String email) throws UserNotFoundException, DuplicateUserAccountException
Description copied from interface:SUser
Updates user fields: username, name and email.- Specified by:
updateUserAccount
in interfaceSUser
- Parameters:
username
- username, cannot be nullname
- full name of a useremail
- email address- Throws:
UserNotFoundException
- if specified user no longer exists in the modelDuplicateUserAccountException
- if a new username name already assigned to another user
-
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
-
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
@Nullable 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
-
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.
-
setPassword
public void setPassword(String password) throws UserNotFoundException
Description copied from interface:SUser
Changes password of this user- Specified by:
setPassword
in interfaceSUser
- Parameters:
password
- new password- Throws:
UserNotFoundException
- if specified user no longer exists
-
hasPassword
public boolean hasPassword()
Description copied from interface:UserEx
Returns true if user has password, false otherwise (e.g. if it was created by NT domain or LDAP login module)- Specified by:
hasPassword
in interfaceUserEx
- Returns:
-
isPseudoUser
public boolean isPseudoUser()
- Specified by:
isPseudoUser
in interfaceUserEx
-
setEmailIsVerified
public boolean setEmailIsVerified(@NotNull String email)
Description copied from interface:UserEx
Mark user`s email as verified if it's equal to email passed in parameter.- Specified by:
setEmailIsVerified
in interfaceUserEx
- Returns:
- true if verified email was set, false otherwise
-
getVerifiedEmail
@Nullable public String getVerifiedEmail()
Description copied from interface:UserEx
Returns null if user doesn't have email specified or his email is not verified.- Specified by:
getVerifiedEmail
in interfaceUserEx
-
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
-
getProjectsOrder
@NotNull public List<String> getProjectsOrder() throws UserNotFoundException
- Specified by:
getProjectsOrder
in interfaceSUser
- Returns:
- List of project internal IDs in configured order. Empty list will be returned in case user didn't configure any order.
- Throws:
UserNotFoundException
- if specified user no longer exists
-
setProjectsOrder
public void setProjectsOrder(@NotNull List<String> projectsOrder) throws UserNotFoundException
Description copied from interface:SUser
Sets order of the projects.- Specified by:
setProjectsOrder
in interfaceSUser
- Parameters:
projectsOrder
- identificators of all projects in the order specified by user- Throws:
UserNotFoundException
- if specified user no longer exists
-
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
-
setVisibleProjects
public void setVisibleProjects(@NotNull Collection<String> visibleProjects) throws UserNotFoundException
Description copied from interface:SUser
Sets projects visible for specified user- Specified by:
setVisibleProjects
in interfaceSUser
- Parameters:
visibleProjects
- collection of identifiers of visible projects- Throws:
UserNotFoundException
- if specified user no longer exists
-
resetRoles
public void resetRoles()
Description copied from interface:UserRolesInit
Causes roles reloading from the database.- Specified by:
resetRoles
in interfaceUserRolesInit
-
hideProject
public void hideProject(@NotNull String projectId) throws UserNotFoundException
Description copied from interface:SUser
Marks a project with specified id as invisible- Specified by:
hideProject
in interfaceSUser
- Parameters:
projectId
- id of the project- Throws:
UserNotFoundException
- if this user does not exist anymore
-
hideProjects
public void hideProjects(@NotNull Collection<String> projectIds) throws UserNotFoundException
Description copied from interface:SUser
Marks the specified projects as invisible- Specified by:
hideProjects
in interfaceSUser
- Parameters:
projectIds
- ids of the project to hide- Throws:
UserNotFoundException
- if this user does not exist anymore
-
addRole
public void addRole(@NotNull RoleScope scope, @NotNull Role role) throws UserNotFoundException
Description copied from interface:RolesHolder
Adds role with specified scope- Specified by:
addRole
in interfaceRolesHolder
- Parameters:
scope
- scope of the rolerole
- role- Throws:
UserNotFoundException
-
setLastLoginTimestamp
public void setLastLoginTimestamp(@NotNull Date timestamp) throws UserNotFoundException
Description copied from interface:SUser
Updates last login timestamp- Specified by:
setLastLoginTimestamp
in interfaceSUser
- Parameters:
timestamp
- last login timestamp- Throws:
UserNotFoundException
- if this user does not exist anymore
-
removeRole
public void removeRole(@NotNull RoleScope scope, @NotNull Role role) throws UserNotFoundException
Description copied from interface:RolesHolder
Removes role with specified scope- Specified by:
removeRole
in interfaceRolesHolder
- Parameters:
scope
- scope of the rolerole
- role- Throws:
UserNotFoundException
-
removeRoles
public void removeRoles(@NotNull RoleScope scope) throws UserNotFoundException
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- Throws:
UserNotFoundException
-
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
-
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
-
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
-
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.
-
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
-
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.
-
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
-
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
-
getOrderedBuildTypes
@NotNull public List<SBuildType> getOrderedBuildTypes(@Nullable SProject project)
Description copied from interface:SUser
Returns the list of build configurations (in a project, or globally) sorted according to user settings. The configurations invisible for the user are omitted.- Specified by:
getOrderedBuildTypes
in interfaceSUser
- Parameters:
project
- the project (can be null)- Returns:
- the list of build configurations
-
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
-
setBuildTypesOrder
public void setBuildTypesOrder(@NotNull SProject project, @NotNull List<SBuildType> visible, @NotNull List<SBuildType> invisible)
Description copied from interface:SUser
Sets visible and invisible build types for the given project in the specified order.- Specified by:
setBuildTypesOrder
in interfaceSUser
- Parameters:
project
- the projectvisible
- the list of visible build typesinvisible
- the list of invisible build types
-
getFilteredVisibleBuildTypes
@NotNull public SortedMap<SProject,List<SBuildType>> getFilteredVisibleBuildTypes(@Nullable BuildTypeFilter filter)
Description copied from interface:UserEx
Returns sorted map of build configurations per project. The build configurations are sorted according to user settings.- Specified by:
getFilteredVisibleBuildTypes
in interfaceUserEx
- Parameters:
filter
- filter of build configurations, can be null- Returns:
- sorted map of build types per project
-
resetBuildTypesOrder
public void resetBuildTypesOrder(@NotNull SProject project)
Description copied from interface:UserEx
Resets the build types order settings to defaults.- Specified by:
resetBuildTypesOrder
in interfaceUserEx
- Parameters:
project
- the project
-
updatePermissions
public void updatePermissions()
Description copied from interface:UserEx
Forces this user to recompute its permissions.- Specified by:
updatePermissions
in interfaceUserEx
-
getOriginalAuthorityHolder
@NotNull public AuthorityHolder getOriginalAuthorityHolder()
Description copied from interface:UserEx
The same asSecurityContextEx.getOriginalAuthority()
- Specified by:
getOriginalAuthorityHolder
in interfaceUserEx
-
isHasHiddenProjects
public boolean isHasHiddenProjects()
Description copied from interface:UserEx
Returns whether the user has any hidden (i.e. configured to be not-visible) projects.- Specified by:
isHasHiddenProjects
in interfaceUserEx
- Returns:
- true if the user has any hidden projects
-
isConfiguredVisibleProjects
public boolean isConfiguredVisibleProjects()
Description copied from interface:UserEx
Returns whether the user has configured visible projects.- Specified by:
isConfiguredVisibleProjects
in interfaceUserEx
- Returns:
- true if the user has configured visible projects
-
getUserGroups
@NotNull public List<UserGroup> getUserGroups()
Description copied from interface:SUser
Returns the list of groups which this user belongs to. Only groups which contain this user directly are considered. If you need all user groups useSUser.getAllUserGroups()
.No specific order of the groups is guaranteed.
- Specified by:
getUserGroups
in interfaceSUser
- Returns:
- list of groups containing this user
- See Also:
SUser.getAllUserGroups()
-
getAllUserGroups
@NotNull public List<UserGroup> getAllUserGroups()
Description copied from interface:SUser
Returns the list of all user groups that include this user, directly or through intermediate subgroups.No specific order of the groups is guaranteed.
- Specified by:
getAllUserGroups
in interfaceSUser
- Returns:
- list of all groups containing this user
- See Also:
SUser.getUserGroups()
-
getVcsUsernameProperties
@NotNull public List<VcsUsernamePropertyKey> getVcsUsernameProperties()
Description copied from interface:SUser
Returns list of VCS username properties associated with this user. VCS username property defines username of this user in a concrete VCS root or VCS repository type (Subversion, Perforce, etc).- Specified by:
getVcsUsernameProperties
in interfaceSUser
- Returns:
- list of VCS usernames
-
getVcsUsernames
@NotNull public Map<VcsUsernamePropertyKey,List<String>> getVcsUsernames()
- Specified by:
getVcsUsernames
in interfaceUserEx
-
getNotificationRules
@NotNull public List<NotificationRule> getNotificationRules(@NotNull String notificatorType)
Description copied from interface:NotificationRulesHolder
Returns the notification rules for specified notifier for this holder (user or group).- Specified by:
getNotificationRules
in interfaceNotificationRulesHolder
- Parameters:
notificatorType
- type of the notifier- Returns:
- list of notification rules for specified notifier
-
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
-
getId
public long getId()
Description copied from interface:User
Returns user id
-
getRealm
public String getRealm()
Description copied from interface:User
Returns realm of the user.
-
getUsername
public String getUsername()
Description copied from interface:User
Returns username of this user- Specified by:
getUsername
in interfaceUser
- Returns:
- username
-
getName
public String getName()
Description copied from interface:User
Returns full name of this user
-
getEmail
public String getEmail()
Description copied from interface:User
Returns e-mail of this user
-
getDescriptiveName
public String getDescriptiveName()
Description copied from interface:User
Returns full name of the user if it is not empty, otherwise returns username.- Specified by:
getDescriptiveName
in interfaceUser
- Returns:
- full name or username if full name is empty
-
getExtendedName
public String getExtendedName()
- Specified by:
getExtendedName
in interfaceUser
- Returns:
- user full name and username in the form: <full name> (<username>)
-
getLastLoginTimestamp
public Date getLastLoginTimestamp()
Description copied from interface:User
Returns this user last login timestamp- Specified by:
getLastLoginTimestamp
in interfaceUser
- Returns:
- last login timestamp
-
isHighlightRelatedDataInUI
public boolean isHighlightRelatedDataInUI()
Description copied from interface:SUser
Returns true if highlighting of user changes, investigations, and other related data in web UI is enabled. The value is controlled by theStandardProperties.HIGHLIGHT_MY_CHANGES
property.- Specified by:
isHighlightRelatedDataInUI
in interfaceSUser
- Returns:
- true if highlighting of user changes, investigations, and other related data in web UI is enabled.
-
isGuest
public boolean isGuest()
Description copied from interface:SUser
Returns true if the user is guest
-
getBuildTypesOrder
@NotNull public Collection<SBuildType> getBuildTypesOrder(@NotNull SProject project)
- Specified by:
getBuildTypesOrder
in interfaceSUser
- Parameters:
project
- the project- Returns:
- List of build configurations in configured order. Empty list will be returned in case user didn't configure any order.
-
describe
@NotNull public String describe(boolean verbose)
-
setDefaultVcsUsernames
public void setDefaultVcsUsernames(@NotNull List<String> userNames)
- Specified by:
setDefaultVcsUsernames
in interfaceUserEx
-
setVcsUsernames
public void setVcsUsernames(@NotNull String vcsName, @NotNull List<String> userNames)
- Specified by:
setVcsUsernames
in interfaceUserEx
-
setVcsRootUsernames
public void setVcsRootUsernames(@NotNull VcsRoot root, @NotNull List<String> userNames)
- Specified by:
setVcsRootUsernames
in interfaceUserEx
-
setVcsUsernames
public void setVcsUsernames(@NotNull VcsUsernamePropertyKey key, @NotNull List<String> userNames)
- Specified by:
setVcsUsernames
in interfaceUserEx
-
addVcsUsername
public void addVcsUsername(@NotNull VcsUsernamePropertyKey key, @NotNull String userName)
- Specified by:
addVcsUsername
in interfaceUserEx
-
getProjectVisibilityHolder
public ProjectVisibilityHolder getProjectVisibilityHolder()
- Specified by:
getProjectVisibilityHolder
in interfaceUserEx
-
setCreationInProgress
public void setCreationInProgress(boolean inProgress)
- Specified by:
setCreationInProgress
in interfaceUserEx
-
init
public void init(@NotNull String username, String name, String email, Long lastLogin, boolean hasPassword)
-
resetBlocks
public void resetBlocks()
Description copied from interface:UserEx
Reset cached blocks- Specified by:
resetBlocks
in interfaceUserEx
-
resetCachedProperties
public void resetCachedProperties()
Description copied from interface:UserEx
Reset cached blocks- Specified by:
resetCachedProperties
in interfaceUserEx
-
resetCachedVcsUsernames
public void resetCachedVcsUsernames()
Description copied from interface:UserEx
Reset cached blocks- Specified by:
resetCachedVcsUsernames
in interfaceUserEx
-
setAttribute
public void setAttribute(@NotNull String attributeKey, @NotNull String attributeValue)
Description copied from interface:UserEx
Set user attribute- Specified by:
setAttribute
in interfaceUserEx
-
getAttribute
@Nullable public String getAttribute(@NotNull String attributeKey)
Description copied from interface:UserEx
Get user attribute- Specified by:
getAttribute
in interfaceUserEx
- Returns:
- user attribute or null if there is no attribute with such key
-
getAttributes
@NotNull public Map<String,String> getAttributes()
Description copied from interface:UserEx
Get all user attributes- Specified by:
getAttributes
in interfaceUserEx
- Returns:
- user attributes or an empty map
-
deleteAttribute
public void deleteAttribute(@NotNull String attributeKey)
Description copied from interface:UserEx
Delete user attribute- Specified by:
deleteAttribute
in interfaceUserEx
-
resetCachedAttributes
public void resetCachedAttributes()
Description copied from interface:UserEx
Reset cached user attributes- Specified by:
resetCachedAttributes
in interfaceUserEx
-
runWithRestrictor
public <T> T runWithRestrictor(@NotNull AuthorityHolderRestrictor restrictor, @NotNull SecurityContextEx.RunAsActionWithResult<T> action)
- Specified by:
runWithRestrictor
in interfaceUserEx
-
-