Interface UsersManager
- All Known Implementing Classes:
UsersManagerEntry
- Author:
- Michal Prochazka, Slavek Licehammer, Zora Sebestianova, Sona Mastrakova
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSpecificUserOwner
(PerunSession sess, User user, User specificUser) Add specificUser owner (the user) If not exists, create new ownership.addUserExtSource
(PerunSession perunSession, User user, UserExtSource userExtSource) Adds user's external sources.addUserExtSourceWithAttributes
(PerunSession sess, User user, UserExtSource userExtSource, List<Attribute> uesAttributes) Adds userExternalSource to the user along with the ues attributes.void
anonymizeUser
(PerunSession perunSession, User user, boolean force) Anonymizes user - according to configuration, each of user's attributes is either anonymized, kept untouched or deleted.void
blockLogins
(PerunSession sess, List<String> logins, String namespace) Block logins for given namespace or block logins globally (if no namespace is selected)void
changeEmail
(PerunSession sess, User user, String newEmail) Change user's email to email from user ext source.void
changeEmailCustom
(PerunSession sess, User user, String newEmail, String url, String lang, String path, String idp) Change user's email to custom email.void
changeName
(PerunSession sess, User user, String newUserName) Change user's name to user's name from user ext source.void
changeNameCustom
(PerunSession sess, User user, String titleBefore, String firstName, String middleName, String lastName, String titleAfter) Change user's name to custom name.void
changeNonAuthzPassword
(PerunSession sess, UUID token, String password, String lang) Changes user password in defined login-namespace based on token parameter.void
changeOrganization
(PerunSession sess, User user, String newOrganizationName) Change organization from which user came to organization from user ext source.void
changeOrganizationCustom
(PerunSession sess, User user, String newOrganizationName) Change organization from which user came to custom organization.void
changePassword
(PerunSession sess, User user, String loginNamespace, String oldPassword, String newPassword, boolean checkOldPassword) Changes user password in defined login-namespace.void
changePassword
(PerunSession sess, String login, String loginNamespace, String oldPassword, String newPassword, boolean checkOldPassword) Changes user password in defined login-namespace.changePasswordRandom
(PerunSession sess, User user, String loginNamespace) Generates new random password for given user and returns String representing HTML where is the new password.void
checkPasswordResetRequestIsValid
(PerunSession sess, UUID token) Checks if the password reset request is valid.void
checkPasswordStrength
(PerunSession sess, String password, String namespace, String login) Check password strength for the given namespace.void
createAlternativePassword
(PerunSession sess, User user, String description, String loginNamespace, String password) Creates alternative password in external system.createServiceUser
(PerunSession sess, Candidate candidate, List<User> specificUserOwners) From given candidate, creates a service user and assign given owners to him.createUser
(PerunSession perunSession, User user) Deprecated.void
deleteAlternativePassword
(PerunSession sess, User user, String loginNamespace, String passwordId) Deletes alternative password in external system.void
deletePassword
(PerunSession sess, User user, String loginNamespace) Deletes password in external system.void
deletePassword
(PerunSession sess, String userLogin, String loginNamespace) Deletes password in external system.void
deleteUser
(PerunSession perunSession, User user) Deletes user.void
deleteUser
(PerunSession perunSession, User user, boolean forceDelete) Deletes user.findRichUsers
(PerunSession sess, String searchString) Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.findRichUsersWithAttributes
(PerunSession sess, String searchString, List<String> attrNames) Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.findRichUsersWithAttributesByExactMatch
(PerunSession sess, String searchString, List<String> attrNames) Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.findRichUsersWithoutSpecificVoWithAttributes
(PerunSession sess, Vo vo, String searchString, List<String> attrsName) Return list of RichUsers who matches the searchString, searching name, email and logins and are not member in specific VO and contain selected attributes.findUsers
(PerunSession sess, String searchString) Returns list of users who matches the searchString, searching name, id, uuid, email, logins.findUsersByExactName
(PerunSession sess, String searchString) Returns list of users who exactly matches the searchStringfindUsersByName
(PerunSession sess, String searchString) Returns list of users who matches the searchStringfindUsersByName
(PerunSession sess, String titleBefore, String firstName, String middleName, String lastName, String titleAfter) Returns list of users who matches the fields.generateAccount
(PerunSession session, String namespace, Map<String, String> parameters) Generate user account in a backend system associated with login-namespace in Perun.Returns all blocked logins in namespaces (if namespace is null, then this login is blocked globally)getAllowedResources
(PerunSession sess, Facility facility, User user) Get all resources from the facility which have the user access on.getAllowedResources
(PerunSession sess, User user) Get all resources which have the user access on.getAllRichUsers
(PerunSession sess, boolean includedSpecificUsers) Get All richUsers with or without specificUsers.getAllRichUsersWithAttributes
(PerunSession sess, boolean includedSpecificUsers) Get All richUsers with or without specificUsers.getAllRichUsersWithAttributes
(PerunSession sess, boolean includedSpecificUsers, List<String> attrsNames) Get All richUsers with or without specificUsers.getAssignedRichResources
(PerunSession sess, User user) Get all rich resources which have the user assigned.getAssociatedResources
(PerunSession sess, Facility facility, User user) Return all resources of specified facility with which user is associated through all his members.getBlockedLoginsPage
(PerunSession sess, BlockedLoginsPageQuery query) Get page of blocked logins.getGroupsWhereUserIsActive
(PerunSession sess, Facility facility, User user) Return all groups where user is active (has VALID status in VO and Group together) for specified user and facilitygetGroupsWhereUserIsActive
(PerunSession sess, Resource resource, User user) Return all groups where user is active (has VALID status in VO and Group together) for specified user and resourcegetGroupsWhereUserIsAdmin
(PerunSession perunSession, User user) Returns list of Groups in Perun, where the User is a direct Administrator or he is VALID a member of any group which is Administrator of some of these Groups.getGroupsWhereUserIsAdmin
(PerunSession sess, Vo vo, User user) Returns list of Groups in selected Vo, where the User is a direct Administrator or he is a VALID member of any group which is Administrator of some of these Groups.getPendingPreferredEmailChanges
(PerunSession sess, User user) Return list of email addresses of user, which are awaiting validation and are inside time window for validation.getRelatedUserIdByBlockedLoginInNamespace
(PerunSession sess, String login, String namespace) Get user id of the user who was related to the given login in the pastgetRichGroupsWhereUserIsActive
(PerunSession sess, Facility facility, User user, List<String> attrNames) Return all groups where user is active (has VALID status in VO and Group together) for specified user and resourcegetRichGroupsWhereUserIsActive
(PerunSession sess, Resource resource, User user, List<String> attrNames) Return all RichGroups where user is active (has VALID status in VO and Group together) for specified user and resource with specified group attributes by their names (URNs).getRichUser
(PerunSession sess, User user) Get User to RichUser without attributes.getRichUserExtSources
(PerunSession perunSession, User user) Gets list of all user's external sources with attributes.getRichUserExtSources
(PerunSession perunSession, User user, List<String> attrsNames) Gets list of all user's external sources with attributes.getRichUsersByIds
(PerunSession sess, List<Integer> ids) Returns rich users without attributes by their ids.getRichUsersWithAttributesByIds
(PerunSession sess, List<Integer> ids) Returns rich users with attributes by their ids.Returns all RichUsers with attributes who are not member of any VO.getRichUsersWithoutVoWithAttributes
(PerunSession sess, List<String> attrNames) Returns list of RichUsers which are not members of any VO and with selected attributesgetRichUserWithAttributes
(PerunSession sess, User user) Get User to RichUser with attributes.getSpecificUsers
(PerunSession sess) Return all specific Users (only specific users)getSpecificUsersByUser
(PerunSession sess, User user) Return all specificUsers who are owned by the usergetSponsors
(PerunSession sess, Member member, List<String> attrNames) Deprecated.- use getSponsorsForMembergetSponsorsForMember
(PerunSession sess, Member member, List<String> attrNames) Gets list of users that sponsor the member, with attributes.getUnanonymizedUsersBySpecificUser
(PerunSession sess, User specificUser) Return all users who owns the specific one and are not anonymizedgetUserAssignments
(PerunSession sess, User user) Returns all assignments of the user, assignments being Facilities and Resources they are assigned to.getUserByExtSourceNameAndExtLogin
(PerunSession sess, String extSourceName, String extLogin) Get user by extSourceName and extSourceLogingetUserById
(PerunSession perunSession, int id) Returns user by his/her id.getUserByMember
(PerunSession perunSession, Member member) Returns user by VO member.getUserByUserExtSource
(PerunSession perunSession, UserExtSource userExtSource) Returns user by his login in external source and external source.getUserByUserExtSources
(PerunSession perunSession, List<UserExtSource> userExtSources) Returns user based on one of the userExtSource.getUserExtSourceByExtLogin
(PerunSession perunSession, ExtSource source, String extLogin) Gets user's external source by the user's external login and external source.getUserExtSourceById
(PerunSession sess, int id) Get the user ext source by its id.getUserExtSourceByUniqueAttributeValue
(PerunSession sess, int attrId, String uniqueValue) Return userExtSource for specific attribute definition (specified by id) and unique value.getUserExtSourceByUniqueAttributeValue
(PerunSession sess, String attrName, String uniqueValue) Return userExtSource for specific attribute definition (specified by name) and unique value.getUserExtSources
(PerunSession perunSession, User user) Gets list of all user's external sources of the user.getUserExtSourcesByIds
(PerunSession sess, List<Integer> ids) Get the user ext sources by their ids.getUserRelations
(PerunSession sess, User user) Gets map with 2 items which are a list of all vos and a list of all groups where given user is member filtered by principal's privileges.getUsers
(PerunSession sess) Returns all users (included specific users).getUsersByAttribute
(PerunSession sess, Attribute attribute) Returns all users who have set the attribute with the value.getUsersByAttribute
(PerunSession sess, String attributeName, String attributeValue) Returns all users who have set the attribute with the value.getUsersByAttributeValue
(PerunSession sess, String attributeName, String attributeValue) Returns all users who have the attribute with the value. attributeValue is not converted to the attribute type, it is always type of String.getUsersByIds
(PerunSession perunSession, List<Integer> ids) Returns existing users by their ids.getUsersBySpecificUser
(PerunSession sess, User specificUser) Return all users who owns the specific oneint
getUsersCount
(PerunSession sess) Get count of all users.getUsersPage
(PerunSession sess, UsersPageQuery query, List<String> attrNames) Get page of users with the given attributes.getUsersWithoutSpecificVo
(PerunSession sess, Vo vo, String searchString) Return list of users who matches the searchString, searching name, email and logins and are not member in specific VO.Returns all users who are not member of any VO.getVosWhereUserIsAdmin
(PerunSession perunSession, User user) Returns list of VOs, where the user is an Administrator.getVosWhereUserIsMember
(PerunSession perunSession, User user) Returns list of VOs, where the user is a member.boolean
isLoginAvailable
(PerunSession sess, String loginNamespace, String login) Checks if the login is available in the namespace.boolean
isLoginBlocked
(PerunSession sess, String login, boolean ignoreCase) Return true if login is blocked (globally - for all namespaces per instance OR for some namespace), false if not.boolean
isLoginBlockedForNamespace
(PerunSession sess, String login, String namespace, boolean ignoreCase) Return true if login is blocked for given namespace, false if not.boolean
isLoginBlockedGlobally
(PerunSession sess, String login) Return true if login is blocked globally (for all namespaces per instance - represented by namespace = null), false if not.boolean
isUserPerunAdmin
(PerunSession sess, User user) Deprecated.boolean
loginExist
(PerunSession sess, User user, String loginNamespace) Check, if login exists in given login-namespace.void
moveUserExtSource
(PerunSession perunSession, User sourceUser, User targetUser, UserExtSource userExtSource) Take UserExtSource from sourceUser and move it to the targetUser.void
removeSpecificUserOwner
(PerunSession sess, User user, User specificUser) Remove specificUser owner (the user) Only disable ownership of user and specificUservoid
removeUserExtSource
(PerunSession perunSession, User user, UserExtSource userExtSource) Removes user's external source.void
removeUserExtSource
(PerunSession perunSession, User user, UserExtSource userExtSource, boolean forceDelete) Removes user's external source.void
removeUserExtSources
(PerunSession perunSession, User user, List<UserExtSource> userExtSources, boolean forceDelete) Removes user's external sources.void
requestPreferredEmailChange
(PerunSession sess, String url, User user, String email, String lang, String path, String idp) Request change of user's preferred email address.void
reservePassword
(PerunSession sess, User user, String loginNamespace, String password) Reserves the password in external system.void
reservePassword
(PerunSession sess, String userLogin, String loginNamespace, String password) Reserves the password in external system.void
reserveRandomPassword
(PerunSession sess, User user, String loginNamespace) Reserves random password in external system.void
setLogin
(PerunSession sess, User user, String loginNamespace, String login) Allow users to manually add login in supported namespace if same login is not reserved.setSpecificUser
(PerunSession sess, User specificUser, SpecificUserType specificUserType, User owner) Set specific user type for specific user and set ownership of this user for the owner.void
unblockLogins
(PerunSession sess, List<String> logins, String namespace) Unblock logins for given namespace or unblock logins globally (if no namespace is selected)void
unblockLoginsById
(PerunSession sess, List<Integer> loginIds) Unblock logins by id globally, or in the namespace they were initially blocked.unsetSpecificUser
(PerunSession sess, User specificUser, SpecificUserType specificUserType) Remove all ownerships of this specific user and unset this specific user type from this specific user.updateNameTitles
(PerunSession perunSession, User user) Updates titles before/after name of user.updateUser
(PerunSession perunSession, User user) Updates users data in DB.updateUserExtSource
(PerunSession perunSession, UserExtSource userExtSource) Updates user's userExtSource in DB.void
updateUserExtSourceLastAccess
(PerunSession perunSession, UserExtSource userExtSource) Updates user's userExtSource last access time in DB.void
validatePassword
(PerunSession sess, User user, String loginNamespace) Validates the password in external system and sets user extSources and extSource related attributes.void
validatePassword
(PerunSession sess, String userLogin, String loginNamespace) Validates the password in external system and sets user extSources and extSource related attributes.validatePreferredEmailChange
(PerunSession sess, User user, UUID token) Validate change of user's preferred email address.void
validateSSHKey
(PerunSession sess, String sshKey) Validate ssh public key, throws exception if validation fails
-
Field Details
-
USERS_QUERY
- See Also:
-
-
Method Details
-
addSpecificUserOwner
void addSpecificUserOwner(PerunSession sess, User user, User specificUser) throws UserNotExistsException, PrivilegeException, NotSpecificUserExpectedException, SpecificUserExpectedException, RelationExistsException Add specificUser owner (the user) If not exists, create new ownership. If exists, only enable ownership for user and specificUser- Parameters:
sess
-user
- the userspecificUser
- the specificUser- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
SpecificUserExpectedException
- when the specificUser is not really specific user (is it normal user)NotSpecificUserExpectedException
- when the user is specific UserRelationExistsException
- If there is such user (the user) who try to add
-
addUserExtSource
UserExtSource addUserExtSource(PerunSession perunSession, User user, UserExtSource userExtSource) throws UserNotExistsException, PrivilegeException, UserExtSourceExistsException Adds user's external sources.- Parameters:
perunSession
-user
-userExtSource
-- Returns:
- user external auth object with newly generated ID
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
UserExtSourceExistsException
-
addUserExtSourceWithAttributes
RichUserExtSource addUserExtSourceWithAttributes(PerunSession sess, User user, UserExtSource userExtSource, List<Attribute> uesAttributes) throws UserNotExistsException, UserExtSourceExistsException, PrivilegeException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException, UserExtSourceNotExistsException, AttributeNotExistsException, WrongAttributeValueException Adds userExternalSource to the user along with the ues attributes.- Parameters:
sess
-user
- user to assign the userExtSource touserExtSource
- the UserExtSource to be createduesAttributes
- the Attributes to be set to the userExtSource- Returns:
- the newly created ues along with its attributes as RichUserExtSource
- Throws:
UserNotExistsException
UserExtSourceExistsException
PrivilegeException
WrongAttributeAssignmentException
WrongReferenceAttributeValueException
UserExtSourceNotExistsException
AttributeNotExistsException
WrongAttributeValueException
-
anonymizeUser
void anonymizeUser(PerunSession perunSession, User user, boolean force) throws UserNotExistsException, PrivilegeException, RelationExistsException, AnonymizationNotSupportedException Anonymizes user - according to configuration, each of user's attributes is either anonymized, kept untouched or deleted. Also deletes other user's related data, e.g. authorships of users publications, mail change and password reset requests, bans... If force is true then also removes associated members.- Parameters:
perunSession
-user
-force
-- Throws:
InternalErrorException
- if an internal error has occurredUserNotExistsException
- if the user doesn't existPrivilegeException
- if the method isn't called by perun adminRelationExistsException
- if the user has some members assignedAnonymizationNotSupportedException
- if an attribute should be anonymized but its module doesn't specify the anonymization process or if the anonymization is not supported at this instance
-
blockLogins
void blockLogins(PerunSession sess, List<String> logins, String namespace) throws PrivilegeException, LoginIsAlreadyBlockedException, LoginExistsException Block logins for given namespace or block logins globally (if no namespace is selected)- Parameters:
sess
-logins
- list of logins to be blockednamespace
- namespace where the logins should be blocked (null means block the logins globally)- Throws:
LoginIsAlreadyBlockedException
LoginExistsException
PrivilegeException
-
changeNonAuthzPassword
void changeNonAuthzPassword(PerunSession sess, UUID token, String password, String lang) throws UserNotExistsException, LoginNotExistsException, PasswordChangeFailedException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException, PasswordStrengthException, PasswordResetLinkExpiredException, PasswordResetLinkNotValidException Changes user password in defined login-namespace based on token parameter.- Parameters:
sess
-token
- token for the password reset requestpassword
- new passwordlang
- language to get notification in- Throws:
InternalErrorException
UserNotExistsException
- When the user who requested the password reset doesn't existLoginNotExistsException
- When user doesn't have login in specified namespaceInvalidLoginException
- When login of user has invalid syntax (is not allowed)PasswordStrengthException
- When password doesn't match expected strength by namespace configurationPasswordResetLinkExpiredException
- When the password reset request expiredPasswordResetLinkNotValidException
- When the password reset request was already used or has never existedPasswordChangeFailedException
- When password change failedPasswordOperationTimeoutException
- When password change timed outPasswordStrengthFailedException
-
changePassword
void changePassword(PerunSession sess, String login, String loginNamespace, String oldPassword, String newPassword, boolean checkOldPassword) throws PrivilegeException, LoginNotExistsException, PasswordDoesntMatchException, PasswordChangeFailedException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException, PasswordStrengthException Changes user password in defined login-namespace. If checkOldPassword is true, then ask authentication system if old password is correct.- Parameters:
sess
- Perun sessionlogin
- String representation of the userLoginloginNamespace
- Login-namespace to change password inoldPassword
- Old passwordnewPassword
- New passwordcheckOldPassword
- If true, validates old password- Throws:
InternalErrorException
PrivilegeException
LoginNotExistsException
- When user doesn't have login in specified namespacePasswordDoesntMatchException
- When old password does not matchPasswordChangeFailedException
PasswordOperationTimeoutException
PasswordStrengthFailedException
InvalidLoginException
PasswordStrengthException
-
changePassword
void changePassword(PerunSession sess, User user, String loginNamespace, String oldPassword, String newPassword, boolean checkOldPassword) throws PrivilegeException, UserNotExistsException, LoginNotExistsException, PasswordDoesntMatchException, PasswordChangeFailedException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException, PasswordStrengthException Changes user password in defined login-namespace. If checkOldPassword is true, then ask authentication system if old password is correct.- Parameters:
sess
- Perun sessionuser
- User requesting password changeloginNamespace
- Login-namespace to change password inoldPassword
- Old passwordnewPassword
- New passwordcheckOldPassword
- If true, validates old password- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
- When the user doesn't existLoginNotExistsException
- When user doesn't have login in specified namespacePasswordDoesntMatchException
- When old password does not matchPasswordChangeFailedException
PasswordOperationTimeoutException
PasswordStrengthFailedException
InvalidLoginException
PasswordStrengthException
-
changePasswordRandom
String changePasswordRandom(PerunSession sess, User user, String loginNamespace) throws PrivilegeException, PasswordOperationTimeoutException, LoginNotExistsException, PasswordChangeFailedException, InvalidLoginException, PasswordStrengthException Generates new random password for given user and returns String representing HTML where is the new password.The HTML template is taken from entityless attribute randomPwdResetTemplate and the loginNamespace is used as a key.
- Parameters:
sess
- sessionuser
- userloginNamespace
- login namespace- Returns:
- String representing HTML with data about new generated password
- Throws:
PrivilegeException
PasswordOperationTimeoutException
LoginNotExistsException
PasswordChangeFailedException
InvalidLoginException
PasswordStrengthException
-
checkPasswordResetRequestIsValid
void checkPasswordResetRequestIsValid(PerunSession sess, UUID token) throws PasswordResetLinkExpiredException, PasswordResetLinkNotValidException Checks if the password reset request is valid. The request is valid, if it was created, never used and hasn't expired yet.- Parameters:
sess
-token
- token for the request to check- Throws:
PasswordResetLinkExpiredException
- when the reset link expiredPasswordResetLinkNotValidException
- when the reset link was already used or has never existed
-
checkPasswordStrength
void checkPasswordStrength(PerunSession sess, String password, String namespace, String login) throws PasswordStrengthException Check password strength for the given namespace. If the password is too weak, the PasswordStrengthException is thrown- Parameters:
password
- password, that will be checkednamespace
- namespace, that will be used to check the strength of the passwordlogin
- login, which may be required for correct password strength check- Throws:
PasswordStrengthException
- When password doesn't match expected strength by namespace configuration
-
createAlternativePassword
void createAlternativePassword(PerunSession sess, User user, String description, String loginNamespace, String password) throws PasswordCreationFailedException, PrivilegeException, UserNotExistsException, LoginNotExistsException, PasswordStrengthException Creates alternative password in external system.- Parameters:
sess
-user
-description
- - description of a password (e.g. 'mobile phone', 'tablet', ...)loginNamespace
-password
- string representation of password- Throws:
InternalErrorException
PasswordCreationFailedException
UserNotExistsException
LoginNotExistsException
PrivilegeException
PasswordStrengthException
-
createServiceUser
User createServiceUser(PerunSession sess, Candidate candidate, List<User> specificUserOwners) throws PrivilegeException, WrongAttributeAssignmentException, UserExtSourceExistsException, WrongReferenceAttributeValueException, WrongAttributeValueException, AttributeNotExistsException, UserNotExistsException From given candidate, creates a service user and assign given owners to him. This method also checks if some of given userExtSources do exist. If so, this method throws a UserExtSourceExistsException. This method can also set only user-def and user-opt attributes for the given candidate.- Parameters:
sess
- sessioncandidate
- candidatespecificUserOwners
- owners to be set for the new user- Returns:
- created service user
- Throws:
UserNotExistsException
- if some of the given owners does not existAttributeNotExistsException
- if some of the given attributes dont existWrongAttributeAssignmentException
- if some of the given attributes have unsupported namespaceUserExtSourceExistsException
- if some of the given UES already existWrongReferenceAttributeValueException
- if some of the given attribute value cannot be set because of some other attribute constraintWrongAttributeValueException
- if some of the given attribute value is invalidPrivilegeException
- insufficient permissions
-
createUser
Deprecated.Inserts user into DB.- Parameters:
perunSession
-user
-- Throws:
InternalErrorException
PrivilegeException
-
deleteAlternativePassword
void deleteAlternativePassword(PerunSession sess, User user, String loginNamespace, String passwordId) throws UserNotExistsException, PasswordDeletionFailedException, PrivilegeException, LoginNotExistsException Deletes alternative password in external system.- Parameters:
sess
-user
-loginNamespace
-passwordId
- passwords ID- Throws:
InternalErrorException
UserNotExistsException
PasswordDeletionFailedException
LoginNotExistsException
PrivilegeException
-
deletePassword
void deletePassword(PerunSession sess, String userLogin, String loginNamespace) throws PasswordDeletionFailedException, PrivilegeException, LoginNotExistsException, PasswordOperationTimeoutException, InvalidLoginException Deletes password in external system. User must not exist.- Parameters:
sess
- Perun sessionuserLogin
- String representation of the userLoginloginNamespace
- Login-namespace to remove password in- Throws:
PrivilegeException
PasswordDeletionFailedException
LoginNotExistsException
- When user doesn't have login in specified namespaceInvalidLoginException
- When login of user has invalid syntax (is not allowed)PasswordOperationTimeoutException
- When password change timed out
-
deletePassword
void deletePassword(PerunSession sess, User user, String loginNamespace) throws PrivilegeException, UserNotExistsException, LoginNotExistsException, InvalidLoginException, PasswordOperationTimeoutException, PasswordDeletionFailedException Deletes password in external system. User must exist. User's login for specified namespace must exist in Perun.- Parameters:
sess
- Perun sessionuser
- User whose password is being removedloginNamespace
- Login-namespace to remove password in- Throws:
PrivilegeException
UserNotExistsException
- When the user doesn't existLoginNotExistsException
- When user doesn't have login in specified namespaceInvalidLoginException
- When login of user has invalid syntax (is not allowed)PasswordOperationTimeoutException
- When password change timed outPasswordDeletionFailedException
-
deleteUser
void deleteUser(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException, RelationExistsException, MemberAlreadyRemovedException, UserAlreadyRemovedException, SpecificUserAlreadyRemovedException, DeletionNotSupportedException Deletes user.- Parameters:
perunSession
-user
-- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
RelationExistsException
- if user has some members assignedMemberAlreadyRemovedException
- if there is at least 1 member deleted but not affected by deleting from DBUserAlreadyRemovedException
- if there are no rows affected by deleting user in DBSpecificUserAlreadyRemovedException
- if there are no rows affected by deleting specific user in DBDeletionNotSupportedException
- if the deletion of users is not supported
-
deleteUser
void deleteUser(PerunSession perunSession, User user, boolean forceDelete) throws UserNotExistsException, PrivilegeException, RelationExistsException, MemberAlreadyRemovedException, UserAlreadyRemovedException, SpecificUserAlreadyRemovedException, DeletionNotSupportedException Deletes user. If forceDelete is true, then removes also associeted members.- Parameters:
perunSession
-user
-forceDelete
- if true, deletes also all members if they are assigned to the user- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
RelationExistsException
- if forceDelete is false and the user has some members assignedMemberAlreadyRemovedException
- if there is at least 1 member deleted but not affected by deleting from DBUserAlreadyRemovedException
- if there are no rows affected by deleting user in DBSpecificUserAlreadyRemovedException
- if there are no rows affected by deleting specific user in DBnDeletionNotSupportedException
- if the deletion of users is not supported
-
findRichUsers
List<RichUser> findRichUsers(PerunSession sess, String searchString) throws UserNotExistsException, PrivilegeException Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.- Parameters:
sess
-searchString
-- Returns:
- list of RichUsers
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
findRichUsersWithAttributes
List<RichUser> findRichUsersWithAttributes(PerunSession sess, String searchString, List<String> attrNames) throws UserNotExistsException, PrivilegeException Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.- Parameters:
sess
-searchString
-attrNames
-- Returns:
- list of RichUsers with selected attributes
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
findRichUsersWithAttributesByExactMatch
List<RichUser> findRichUsersWithAttributesByExactMatch(PerunSession sess, String searchString, List<String> attrNames) throws UserNotExistsException, PrivilegeException Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins. Name part is searched for exact match.- Parameters:
sess
-searchString
-attrNames
-- Returns:
- list of RichUsers with selected attributes
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
findRichUsersWithoutSpecificVoWithAttributes
List<RichUser> findRichUsersWithoutSpecificVoWithAttributes(PerunSession sess, Vo vo, String searchString, List<String> attrsName) throws UserNotExistsException, PrivilegeException Return list of RichUsers who matches the searchString, searching name, email and logins and are not member in specific VO and contain selected attributes.- Parameters:
sess
-vo
-searchString
-attrsName
-- Returns:
- list of RichUsers
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
findUsers
Returns list of users who matches the searchString, searching name, id, uuid, email, logins.- Parameters:
sess
-searchString
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
-
findUsersByExactName
Returns list of users who exactly matches the searchString- Parameters:
sess
-searchString
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
-
findUsersByName
Returns list of users who matches the searchString- Parameters:
sess
-searchString
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
-
findUsersByName
List<User> findUsersByName(PerunSession sess, String titleBefore, String firstName, String middleName, String lastName, String titleAfter) throws PrivilegeException Returns list of users who matches the fields.- Parameters:
sess
-titleBefore
-firstName
-middleName
-lastName
-titleAfter
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
-
generateAccount
Map<String,String> generateAccount(PerunSession session, String namespace, Map<String, String> parameters) throws PrivilegeException, PasswordStrengthExceptionGenerate user account in a backend system associated with login-namespace in Perun.This method consumes optional parameters map. Requirements are implementation-dependant for each login-namespace.
Returns map with 1: key=login-namespace attribute urn, value=generated login 2: rest of opt response attributes...
- Parameters:
session
-namespace
- Namespace to generate account inparameters
- Optional parameters- Returns:
- Map of data from backed response
- Throws:
InternalErrorException
PrivilegeException
PasswordStrengthException
-
getAllBlockedLoginsInNamespaces
Returns all blocked logins in namespaces (if namespace is null, then this login is blocked globally)- Parameters:
sess
-- Returns:
- list of all blocked logins in namespaces
- Throws:
PrivilegeException
-
getAllRichUsers
List<RichUser> getAllRichUsers(PerunSession sess, boolean includedSpecificUsers) throws PrivilegeException Get All richUsers with or without specificUsers. If includedSpecificUsers is true, you got all Users included specificUsers If includedSpecificUsers is false, you get all Users without specificUsers!!! This method get all RichUsers without Attributes !!!
- Parameters:
sess
-includedSpecificUsers
- true or false if you want or dont want get specificUsers too- Returns:
- list of RichUsers
- Throws:
InternalErrorException
PrivilegeException
-
getAllRichUsersWithAttributes
List<RichUser> getAllRichUsersWithAttributes(PerunSession sess, boolean includedSpecificUsers) throws PrivilegeException, UserNotExistsException Get All richUsers with or without specificUsers. If includedSpecificUsers is true, you got all Users included specificUsers If includedSpecificUsers is false, you get all Users without specificUsersThis method get all RichUsers included Attributes.
- Parameters:
sess
-includedSpecificUsers
- true or false if you want or dont want get specificUsers too- Returns:
- list of RichUsers
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getAllRichUsersWithAttributes
List<RichUser> getAllRichUsersWithAttributes(PerunSession sess, boolean includedSpecificUsers, List<String> attrsNames) throws PrivilegeException, UserNotExistsException Get All richUsers with or without specificUsers. If includedSpecificUsers is true, you got all Users included specificUsers If includedSpecificUsers is false, you get all Users without specificUsersThis method get all RichUsers included selected Attributes.
- Parameters:
sess
-includedSpecificUsers
- true or false if you want or dont want get specificUsers tooattrsNames
-- Returns:
- list of RichUsers
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getAllowedResources
List<Resource> getAllowedResources(PerunSession sess, Facility facility, User user) throws FacilityNotExistsException, UserNotExistsException, PrivilegeException Get all resources from the facility which have the user access on.- Parameters:
sess
-facility
-user
-- Returns:
- list of resources which have the user acess on
- Throws:
InternalErrorException
FacilityNotExistsException
UserNotExistsException
PrivilegeException
-
getAllowedResources
List<Resource> getAllowedResources(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException Get all resources which have the user access on.- Parameters:
sess
-user
-- Returns:
- list of resources which have the user acess on
- Throws:
UserNotExistsException
PrivilegeException
-
getUserAssignments
Map<Facility,List<Resource>> getUserAssignments(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException Returns all assignments of the user, assignments being Facilities and Resources they are assigned to.- Parameters:
sess
- sessionuser
- user- Returns:
- the assignments
- Throws:
UserNotExistsException
- user does not existPrivilegeException
- insufficient rights
-
getAssignedRichResources
List<RichResource> getAssignedRichResources(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException Get all rich resources which have the user assigned.- Parameters:
sess
-user
-- Returns:
- list of rich resources which have the user assigned
- Throws:
UserNotExistsException
PrivilegeException
-
getAssociatedResources
List<Resource> getAssociatedResources(PerunSession sess, Facility facility, User user) throws UserNotExistsException, FacilityNotExistsException, PrivilegeException Return all resources of specified facility with which user is associated through all his members. Does not require ACTIVE group-resource assignment.- Parameters:
sess
-facility
-user
-- Returns:
- All resources with which user is associated
- Throws:
UserNotExistsException
FacilityNotExistsException
PrivilegeException
-
getBlockedLoginsPage
Paginated<BlockedLogin> getBlockedLoginsPage(PerunSession sess, BlockedLoginsPageQuery query) throws PrivilegeException Get page of blocked logins.- Parameters:
sess
- sessionquery
- query with page information- Returns:
- page of requested blocked logins
- Throws:
PrivilegeException
-
getGroupsWhereUserIsActive
List<Group> getGroupsWhereUserIsActive(PerunSession sess, Resource resource, User user) throws PrivilegeException Return all groups where user is active (has VALID status in VO and Group together) for specified user and resource- Parameters:
sess
- PerunSessionresource
- Only groups assigned to this resource might be returneduser
- Only groups where this user is VALID member might be returned- Returns:
- List of groups where user is active (is a VALID vo and group member) on specified resource
- Throws:
PrivilegeException
-
getGroupsWhereUserIsActive
List<Group> getGroupsWhereUserIsActive(PerunSession sess, Facility facility, User user) throws PrivilegeException Return all groups where user is active (has VALID status in VO and Group together) for specified user and facility- Parameters:
sess
- PerunSessionfacility
- Only groups assigned to this facility (all its resources) might be returneduser
- Only groups where this user is VALID member might be returned- Returns:
- List of groups where user is active (is a VALID vo and group member) on specified facility
- Throws:
PrivilegeException
-
getGroupsWhereUserIsAdmin
List<Group> getGroupsWhereUserIsAdmin(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Returns list of Groups in Perun, where the User is a direct Administrator or he is VALID a member of any group which is Administrator of some of these Groups.- Parameters:
perunSession
-user
-- Returns:
- list of Groups, where user or some of his groups is an Administrator
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getGroupsWhereUserIsAdmin
List<Group> getGroupsWhereUserIsAdmin(PerunSession sess, Vo vo, User user) throws PrivilegeException, UserNotExistsException, VoNotExistsException Returns list of Groups in selected Vo, where the User is a direct Administrator or he is a VALID member of any group which is Administrator of some of these Groups.- Parameters:
sess
-vo
- selected Vo under which we are looking for groupsuser
- manager of groups we are looking for- Returns:
- list of Groups, where user or some of his groups (in the Vo) is an Administrator
- Throws:
InternalErrorException
PrivilegeException
- user has no privileges to call this methodUserNotExistsException
- the user not exists in PerunVoNotExistsException
- the vo not exists in Perun
-
getPendingPreferredEmailChanges
List<String> getPendingPreferredEmailChanges(PerunSession sess, User user) throws PrivilegeException, UserNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException Return list of email addresses of user, which are awaiting validation and are inside time window for validation.If there is no preferred email change request pending or requests are outside time window for validation, returns empty list.
- Parameters:
sess
- PerunSessionuser
- User to check pending request for- Returns:
- List
user's email addresses pending validation - Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
WrongAttributeAssignmentException
AttributeNotExistsException
-
getRelatedUserIdByBlockedLoginInNamespace
Integer getRelatedUserIdByBlockedLoginInNamespace(PerunSession sess, String login, String namespace) throws LoginIsNotBlockedException Get user id of the user who was related to the given login in the past- Parameters:
sess
- sessionlogin
- blocked loginnamespace
- namespace where the login is blocked- Returns:
- user id or null if there is no related user id
- Throws:
LoginIsNotBlockedException
-
getRichGroupsWhereUserIsActive
List<RichGroup> getRichGroupsWhereUserIsActive(PerunSession sess, Resource resource, User user, List<String> attrNames) throws PrivilegeException Return all RichGroups where user is active (has VALID status in VO and Group together) for specified user and resource with specified group attributes by their names (URNs).- Parameters:
sess
- PerunSessionresource
- Only groups assigned to this resource might be returneduser
- Only groups where this user is VALID member might be returnedattrNames
- Names (URNs) of group attributes to get with each returned group- Returns:
- List of groups where user is active (is a VALID vo and group member) on specified resource
- Throws:
PrivilegeException
-
getRichGroupsWhereUserIsActive
List<RichGroup> getRichGroupsWhereUserIsActive(PerunSession sess, Facility facility, User user, List<String> attrNames) throws PrivilegeException Return all groups where user is active (has VALID status in VO and Group together) for specified user and resource- Parameters:
sess
- PerunSessionfacility
- Only groups assigned to this facility (all its resources) might be returneduser
- Only groups where this user is VALID member might be returnedattrNames
- Names (URNs) of group attributes to get with each returned group- Returns:
- List of groups where user is active (is a VALID vo and group member) on specified facility
- Throws:
PrivilegeException
-
getRichUser
RichUser getRichUser(PerunSession sess, User user) throws PrivilegeException, UserNotExistsException Get User to RichUser without attributes.- Parameters:
sess
-user
-- Returns:
- RichUser
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getRichUserExtSources
List<RichUserExtSource> getRichUserExtSources(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Gets list of all user's external sources with attributes.- Parameters:
perunSession
- sessionuser
- user for which should be returned rich ext sources- Returns:
- list of user's external sources with attributes
- Throws:
InternalErrorException
- internal errorUserNotExistsException
- if given user doesn't existPrivilegeException
- insufficient permissions
-
getRichUserExtSources
List<RichUserExtSource> getRichUserExtSources(PerunSession perunSession, User user, List<String> attrsNames) throws UserNotExistsException, PrivilegeException Gets list of all user's external sources with attributes. If any of the attribute names is incorrect then the value is silently skipped. If the attrsNames is null, then this method returns all ues attributes.- Parameters:
perunSession
- sessionuser
- user for which should be returned rich ext sourcesattrsNames
- list of attribute names that should be found- Returns:
- list of user's external sources with attributes
- Throws:
InternalErrorException
- internal errorUserNotExistsException
- if given user doesn't existPrivilegeException
- insufficient permissions
-
getRichUserWithAttributes
RichUser getRichUserWithAttributes(PerunSession sess, User user) throws PrivilegeException, UserNotExistsException Get User to RichUser with attributes.- Parameters:
sess
-user
-- Returns:
- RichUser
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getRichUsersByIds
Returns rich users without attributes by their ids.- Parameters:
sess
-ids
-- Returns:
- list of rich users with specified ids
- Throws:
InternalErrorException
PrivilegeException
-
getRichUsersWithAttributesByIds
List<RichUser> getRichUsersWithAttributesByIds(PerunSession sess, List<Integer> ids) throws PrivilegeException, UserNotExistsException Returns rich users with attributes by their ids.- Parameters:
sess
-ids
-- Returns:
- list of rich users with specified ids
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getRichUsersWithoutVoAssigned
List<RichUser> getRichUsersWithoutVoAssigned(PerunSession sess) throws UserNotExistsException, PrivilegeException Returns all RichUsers with attributes who are not member of any VO.- Parameters:
sess
-- Returns:
- list of richUsers who are not member of any VO
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getRichUsersWithoutVoWithAttributes
List<RichUser> getRichUsersWithoutVoWithAttributes(PerunSession sess, List<String> attrNames) throws UserNotExistsException, PrivilegeException Returns list of RichUsers which are not members of any VO and with selected attributes- Parameters:
sess
-attrNames
-- Returns:
- list of RichUsers with selected attributes
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
getSpecificUsers
Return all specific Users (only specific users)- Parameters:
sess
-- Returns:
- list of all specific users in perun
- Throws:
InternalErrorException
PrivilegeException
-
getSpecificUsersByUser
List<User> getSpecificUsersByUser(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException, NotSpecificUserExpectedException Return all specificUsers who are owned by the user- Parameters:
sess
-user
- the user- Returns:
- list of specific users who are owned by the user
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
NotSpecificUserExpectedException
- when the user is service User
-
getSponsors
@Deprecated List<RichUser> getSponsors(PerunSession sess, Member member, List<String> attrNames) throws PrivilegeException, UserNotExistsException Deprecated.- use getSponsorsForMemberGets list of users that sponsor the member, with attributes.- Parameters:
sess
- Perun sessionmember
- member which is sponsoredattrNames
- list of attributes. if null or empty, returns all attributes- Returns:
- list of users which sponsor the member
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getSponsorsForMember
List<Sponsor> getSponsorsForMember(PerunSession sess, Member member, List<String> attrNames) throws PrivilegeException Gets list of users that sponsor the member, with attributes.- Parameters:
sess
- Perun sessionmember
- member which is sponsoredattrNames
- list of attributes. if null or empty, returns all attributes- Returns:
- list of users which sponsor the member
- Throws:
PrivilegeException
- insufficient permissions
-
getUserByExtSourceNameAndExtLogin
User getUserByExtSourceNameAndExtLogin(PerunSession sess, String extSourceName, String extLogin) throws ExtSourceNotExistsException, UserExtSourceNotExistsException, UserNotExistsException, PrivilegeException Get user by extSourceName and extSourceLogin- Parameters:
sess
-extSourceName
-extLogin
-- Returns:
- user
- Throws:
ExtSourceNotExistsException
UserExtSourceNotExistsException
UserNotExistsException
InternalErrorException
PrivilegeException
-
getUserById
User getUserById(PerunSession perunSession, int id) throws UserNotExistsException, PrivilegeException Returns user by his/her id.- Parameters:
perunSession
-id
-- Returns:
- user
- Throws:
UserNotExistsException
InternalErrorException
PrivilegeException
-
getUserByMember
User getUserByMember(PerunSession perunSession, Member member) throws MemberNotExistsException, PrivilegeException Returns user by VO member.- Parameters:
perunSession
-member
-- Returns:
- user
- Throws:
UserNotExistsException
InternalErrorException
MemberNotExistsException
PrivilegeException
-
getUserByUserExtSource
User getUserByUserExtSource(PerunSession perunSession, UserExtSource userExtSource) throws UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException Returns user by his login in external source and external source.- Parameters:
perunSession
-userExtSource
-- Returns:
- selected user or throws UserNotExistsException in case the user doesn't exists
- Throws:
InternalErrorException
UserNotExistsException
UserExtSourceNotExistsException
PrivilegeException
-
getUserByUserExtSources
User getUserByUserExtSources(PerunSession perunSession, List<UserExtSource> userExtSources) throws UserNotExistsException, PrivilegeException Returns user based on one of the userExtSource.- Parameters:
perunSession
-userExtSources
-- Returns:
- user
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
getUserExtSourceByExtLogin
UserExtSource getUserExtSourceByExtLogin(PerunSession perunSession, ExtSource source, String extLogin) throws PrivilegeException, ExtSourceNotExistsException, UserExtSourceNotExistsException Gets user's external source by the user's external login and external source.- Parameters:
perunSession
-source
-extLogin
-- Returns:
- user external source object
- Throws:
InternalErrorException
PrivilegeException
ExtSourceNotExistsException
UserExtSourceNotExistsException
-
getUserExtSourceById
UserExtSource getUserExtSourceById(PerunSession sess, int id) throws UserExtSourceNotExistsException, PrivilegeException Get the user ext source by its id.- Parameters:
sess
-id
-- Returns:
- user external source for the id
- Throws:
InternalErrorException
UserExtSourceNotExistsException
PrivilegeException
-
getUserExtSourceByUniqueAttributeValue
UserExtSource getUserExtSourceByUniqueAttributeValue(PerunSession sess, int attrId, String uniqueValue) throws AttributeNotExistsException, UserExtSourceNotExistsException, PrivilegeException Return userExtSource for specific attribute definition (specified by id) and unique value. If not found, throw and exception.It looks for exactly one value of the specific attribute type: - Integer -> exactly match - String -> exactly match - Map -> exactly match of "key=value" - ArrayList -> exactly match of one of the value
- Parameters:
sess
- Perun sessionattrId
- attribute id used for founding attribute definition which has to exists, be unique and in userExtSource namespaceuniqueValue
- value used for searching- Returns:
- userExtSource found by attribute id and it's unique value
- Throws:
UserExtSourceNotExistsException
- if userExtSource can't be foundAttributeNotExistsException
- if attribute can't be found by it's idPrivilegeException
- if the principal does not have sufficient rights to call this method
-
getUserExtSourceByUniqueAttributeValue
UserExtSource getUserExtSourceByUniqueAttributeValue(PerunSession sess, String attrName, String uniqueValue) throws AttributeNotExistsException, UserExtSourceNotExistsException, PrivilegeException Return userExtSource for specific attribute definition (specified by name) and unique value. If not found, throw and exception.It looks for exactly one value of the specific attribute type: - Integer -> exactly match - String -> exactly match - Map -> exactly match of "key=value" - ArrayList -> exactly match of one of the value
- Parameters:
sess
- Perun sessionattrName
- attribute name used for founding attribute definition which has to exists, be unique and in userExtSource namespaceuniqueValue
- value used for searching- Returns:
- userExtSource found by attribute name and it's unique value
- Throws:
UserExtSourceNotExistsException
- if userExtSource can't be foundAttributeNotExistsException
- if attribute can't be found by it's namePrivilegeException
- if the principal does not have sufficient rights to call this method
-
getUserExtSources
List<UserExtSource> getUserExtSources(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Gets list of all user's external sources of the user.- Parameters:
perunSession
-user
-- Returns:
- list of user's external sources
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getUserExtSourcesByIds
List<UserExtSource> getUserExtSourcesByIds(PerunSession sess, List<Integer> ids) throws PrivilegeException Get the user ext sources by their ids.- Parameters:
sess
-ids
-- Returns:
- list of user external sources with specified ids
- Throws:
InternalErrorException
PrivilegeException
-
getUsers
Returns all users (included specific users).- Parameters:
sess
-- Returns:
- list of all users
- Throws:
InternalErrorException
PrivilegeException
-
getUsersByAttribute
Returns all users who have set the attribute with the value. Searching only def and opt attributes.- Parameters:
sess
-attribute
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
-
getUsersByAttribute
List<User> getUsersByAttribute(PerunSession sess, String attributeName, String attributeValue) throws PrivilegeException, AttributeNotExistsException Returns all users who have set the attribute with the value. Searching by attributeName. Searching only def and opt attributes. Can find only attributes with String Value by this way! (not Integer, Map or List)- Parameters:
sess
-attributeName
-attributeValue
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
AttributeNotExistsException
-
getUsersByAttributeValue
List<User> getUsersByAttributeValue(PerunSession sess, String attributeName, String attributeValue) throws PrivilegeException, AttributeNotExistsException Returns all users who have the attribute with the value. attributeValue is not converted to the attribute type, it is always type of String.- Parameters:
sess
-attributeName
-attributeValue
-- Returns:
- list of users
- Throws:
InternalErrorException
PrivilegeException
AttributeNotExistsException
-
getUsersByIds
Returns existing users by their ids.- Parameters:
perunSession
-ids
-- Returns:
- list of users with specified ids
- Throws:
InternalErrorException
PrivilegeException
-
getUsersBySpecificUser
List<User> getUsersBySpecificUser(PerunSession sess, User specificUser) throws UserNotExistsException, PrivilegeException, SpecificUserExpectedException Return all users who owns the specific one- Parameters:
sess
-specificUser
- the specific user- Returns:
- list of user who owns the specificUser
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
SpecificUserExpectedException
- when the serviceUser is not really service user (is it normal user)
-
getUnanonymizedUsersBySpecificUser
List<User> getUnanonymizedUsersBySpecificUser(PerunSession sess, User specificUser) throws UserNotExistsException, PrivilegeException, SpecificUserExpectedException Return all users who owns the specific one and are not anonymized- Parameters:
sess
-specificUser
- the specific user- Returns:
- list of user who owns the specificUser
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
SpecificUserExpectedException
- when the serviceUser is not really service user (is it normal user)
-
getUsersCount
Get count of all users.- Parameters:
sess
- PerunSession- Returns:
- count of all users
- Throws:
InternalErrorException
-
getUsersPage
Paginated<RichUser> getUsersPage(PerunSession sess, UsersPageQuery query, List<String> attrNames) throws PrivilegeException, ResourceNotExistsException, VoNotExistsException, FacilityNotExistsException, ServiceNotExistsException Get page of users with the given attributes.- Parameters:
sess
- sessionquery
- query with page informationattrNames
- list of attribute names- Returns:
- page of requested rich users
- Throws:
ResourceNotExistsException
- if resource with id from query does not existVoNotExistsException
- if vo with id from query does not existFacilityNotExistsException
- if facility with id from query does not existServiceNotExistsException
- if service with id from query does not existPrivilegeException
-
getUsersWithoutSpecificVo
List<User> getUsersWithoutSpecificVo(PerunSession sess, Vo vo, String searchString) throws VoNotExistsException, PrivilegeException Return list of users who matches the searchString, searching name, email and logins and are not member in specific VO.- Parameters:
sess
-vo
-searchString
-- Returns:
- Throws:
InternalErrorException
VoNotExistsException
PrivilegeException
-
getUsersWithoutVoAssigned
Returns all users who are not member of any VO.- Parameters:
sess
-- Returns:
- list of users who are not member of any VO
- Throws:
InternalErrorException
PrivilegeException
-
getVosWhereUserIsAdmin
List<Vo> getVosWhereUserIsAdmin(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Returns list of VOs, where the user is an Administrator. Including VOs, where the user is a VALID member of authorized group.- Parameters:
perunSession
-user
-- Returns:
- list of VOs, where the user is an Administrator.
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
getVosWhereUserIsMember
List<Vo> getVosWhereUserIsMember(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Returns list of VOs, where the user is a member.- Parameters:
perunSession
-user
-- Returns:
- list of VOs, where the user is a member.
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
isLoginAvailable
boolean isLoginAvailable(PerunSession sess, String loginNamespace, String login) throws InvalidLoginException Checks if the login is available in the namespace. Returns FALSE is is already occupied, throws exception if value is not allowed.- Parameters:
sess
-loginNamespace
- in which the login will be checked (provide only the name of the namespace, not the whole attribute name)login
- to be checked- Returns:
- true if login is available, false otherwise
- Throws:
InvalidLoginException
- When login to check has invalid syntax.
-
isLoginBlocked
boolean isLoginBlocked(PerunSession sess, String login, boolean ignoreCase) throws PrivilegeException Return true if login is blocked (globally - for all namespaces per instance OR for some namespace), false if not. Globally banned logins are ALWAYS case-insensitive (ignoreCase value is not taken into account for them).- Parameters:
sess
- sessionlogin
- login to checkignoreCase
- ignore case- Returns:
- true if login is blocked
- Throws:
PrivilegeException
-
isLoginBlockedForNamespace
boolean isLoginBlockedForNamespace(PerunSession sess, String login, String namespace, boolean ignoreCase) throws PrivilegeException Return true if login is blocked for given namespace, false if not. When the namespace is null, then the method behaves like isLoginBlockedGlobally(), so it checks if the login is blocked globally. Globally banned logins are ALWAYS case-insensitive.- Parameters:
sess
- sessionlogin
- login to checknamespace
- namespace for loginignoreCase
- ignore case- Returns:
- true if login is blocked for given namespace (or globally for null namespace)
- Throws:
PrivilegeException
-
isLoginBlockedGlobally
Return true if login is blocked globally (for all namespaces per instance - represented by namespace = null), false if not. Globally banned logins are ALWAYS case-insensitive.- Parameters:
sess
- sessionlogin
- login to check- Returns:
- true if login is blocked globally
- Throws:
PrivilegeException
-
isUserPerunAdmin
@Deprecated boolean isUserPerunAdmin(PerunSession sess, User user) throws PrivilegeException, UserNotExistsException Deprecated.Returns true if the user is PERUNADMIN.- Parameters:
sess
-user
-- Returns:
- true if the user is PERUNADMIN, false otherwise.
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
loginExist
boolean loginExist(PerunSession sess, User user, String loginNamespace) throws PrivilegeException, UserNotExistsException Check, if login exists in given login-namespace. Not implemented for all namespaces.- Parameters:
sess
- Perun sessionuser
- User to check existence of login forloginNamespace
- Login-namespace to check it for- Returns:
- True if login exists, false otherwise
- Throws:
PrivilegeException
UserNotExistsException
- When the user doesn't exist
-
moveUserExtSource
void moveUserExtSource(PerunSession perunSession, User sourceUser, User targetUser, UserExtSource userExtSource) throws UserExtSourceNotExistsException, UserNotExistsException, PrivilegeException Take UserExtSource from sourceUser and move it to the targetUser.It removes old UserExtSource with all it's attributes from sourceUser and creates and assigns the new one with the same settings to target user.
- Parameters:
perunSession
-sourceUser
- user with UserExtSource to movetargetUser
- user for who will be UserExtSource moveduserExtSource
- the UserExtSource which will be moved from sourceUser to targetUser- Throws:
InternalErrorException
UserExtSourceNotExistsException
- UserExtSourceNotExists or is not assigned to sourceUserUserNotExistsException
- one of the users not existsPrivilegeException
-
removeSpecificUserOwner
void removeSpecificUserOwner(PerunSession sess, User user, User specificUser) throws UserNotExistsException, PrivilegeException, NotSpecificUserExpectedException, SpecificUserExpectedException, RelationNotExistsException, SpecificUserOwnerAlreadyRemovedException Remove specificUser owner (the user) Only disable ownership of user and specificUser- Parameters:
sess
-user
- the userspecificUser
- the specificUser- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
SpecificUserExpectedException
- when the specific user is not really specific user (is it normal user)NotSpecificUserExpectedException
- when the user is specific UserRelationNotExistsException
- if there is no such user (the user) to removeSpecificUserOwnerAlreadyRemovedException
- if there are 0 rows affected by removing from DB
-
removeUserExtSource
void removeUserExtSource(PerunSession perunSession, User user, UserExtSource userExtSource) throws UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException, UserExtSourceAlreadyRemovedException Removes user's external source.- Parameters:
perunSession
-user
-userExtSource
-- Throws:
InternalErrorException
PrivilegeException
UserExtSourceNotExistsException
UserNotExistsException
UserExtSourceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
removeUserExtSource
void removeUserExtSource(PerunSession perunSession, User user, UserExtSource userExtSource, boolean forceDelete) throws UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException, UserExtSourceAlreadyRemovedException Removes user's external source.- Parameters:
perunSession
-user
-userExtSource
-forceDelete
- if true, persistent ExtSource is deleted too- Throws:
InternalErrorException
PrivilegeException
UserExtSourceNotExistsException
UserNotExistsException
UserExtSourceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
removeUserExtSources
void removeUserExtSources(PerunSession perunSession, User user, List<UserExtSource> userExtSources, boolean forceDelete) throws UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException, UserExtSourceAlreadyRemovedException Removes user's external sources.- Parameters:
perunSession
-user
-userExtSources
-forceDelete
- if true, persistent ExtSource is deleted too- Throws:
InternalErrorException
PrivilegeException
UserExtSourceNotExistsException
UserNotExistsException
UserExtSourceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
requestPreferredEmailChange
void requestPreferredEmailChange(PerunSession sess, String url, User user, String email, String lang, String path, String idp) throws PrivilegeException, UserNotExistsException Request change of user's preferred email address. Change in attribute value is not done, until email address is verified by link in email notice. (urn:perun:user:attribute-def:def:preferredMail)- Parameters:
sess
- PerunSessionurl
- base URL of running perun instance passed from RPC.user
- User to request preferred email change foremail
- new email addresslang
- Language to get confirmation mail in (optional)path
- path that is appended to the url of the verification link (optional)idp
- authentication method appended to query parameters of verification link (optional)- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
-
reservePassword
void reservePassword(PerunSession sess, String userLogin, String loginNamespace, String password) throws PasswordCreationFailedException, PrivilegeException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException, PasswordStrengthException Reserves the password in external system. User must not exist.- Parameters:
sess
- Perun sessionuserLogin
- String representation of the userLoginloginNamespace
- Login-namespace to reserve password inpassword
- Password to be reserved- Throws:
InternalErrorException
PasswordCreationFailedException
InvalidLoginException
- When login of user has invalid syntax (is not allowed)PrivilegeException
PasswordOperationTimeoutException
PasswordStrengthFailedException
PasswordStrengthException
-
reservePassword
void reservePassword(PerunSession sess, User user, String loginNamespace, String password) throws PasswordCreationFailedException, PrivilegeException, UserNotExistsException, LoginNotExistsException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException, PasswordStrengthException Reserves the password in external system. User must exist. User's login for specified namespace must exist in Perun.- Parameters:
sess
- Perun sessionuser
- User to reserve password forloginNamespace
- Login-namespace to reserve password inpassword
- Password to be reserved- Throws:
InternalErrorException
PasswordCreationFailedException
UserNotExistsException
- When the user doesn't existLoginNotExistsException
- When user doesn't have login in specified namespacePrivilegeException
PasswordOperationTimeoutException
PasswordStrengthFailedException
InvalidLoginException
PasswordStrengthException
-
reserveRandomPassword
void reserveRandomPassword(PerunSession sess, User user, String loginNamespace) throws PasswordCreationFailedException, PrivilegeException, UserNotExistsException, LoginNotExistsException, PasswordOperationTimeoutException, PasswordStrengthFailedException, InvalidLoginException Reserves random password in external system. User must exist. User's login for specified namespace must exist in Perun.- Parameters:
sess
- Perun sessionuser
- User to reserve password forloginNamespace
- Login-namespace to reserve password in- Throws:
InternalErrorException
PasswordCreationFailedException
UserNotExistsException
- When the user doesn't existLoginNotExistsException
- When user doesn't have login in specified namespacePrivilegeException
PasswordOperationTimeoutException
PasswordStrengthFailedException
InvalidLoginException
-
setLogin
void setLogin(PerunSession sess, User user, String loginNamespace, String login) throws PrivilegeException, UserNotExistsException, LoginExistsException, InvalidLoginException Allow users to manually add login in supported namespace if same login is not reserved. Can be set only to own service or guest users => specific users.- Parameters:
sess
-user
-loginNamespace
-login
-- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
LoginExistsException
InvalidLoginException
-
setSpecificUser
User setSpecificUser(PerunSession sess, User specificUser, SpecificUserType specificUserType, User owner) throws RelationExistsException, UserNotExistsException, PrivilegeException Set specific user type for specific user and set ownership of this user for the owner.- Parameters:
sess
- perun sessionspecificUser
- specific userspecificUserType
- specific type of userowner
- user, who will be owner of the specific user- Returns:
- specific user with specific user type set
- Throws:
InternalErrorException
RelationExistsException
UserNotExistsException
PrivilegeException
-
unblockLogins
void unblockLogins(PerunSession sess, List<String> logins, String namespace) throws PrivilegeException, LoginIsNotBlockedException Unblock logins for given namespace or unblock logins globally (if no namespace is selected)- Parameters:
sess
-logins
- list of logins to be unblockednamespace
- namespace where the logins should be unblocked (null means unblock the logins globally)- Throws:
LoginIsNotBlockedException
PrivilegeException
-
unblockLoginsById
void unblockLoginsById(PerunSession sess, List<Integer> loginIds) throws PrivilegeException, LoginIsNotBlockedException Unblock logins by id globally, or in the namespace they were initially blocked.- Parameters:
sess
- sessionloginIds
- list of login ids- Throws:
PrivilegeException
- insufficient permissionsLoginIsNotBlockedException
- when login is not blocked
-
unsetSpecificUser
User unsetSpecificUser(PerunSession sess, User specificUser, SpecificUserType specificUserType) throws UserNotExistsException, PrivilegeException, ServiceOnlyRoleAssignedException Remove all ownerships of this specific user and unset this specific user type from this specific user.- Parameters:
sess
- perun sessionspecificUser
- specific userspecificUserType
- specific type of user- Returns:
- user who is no more specific
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
ServiceOnlyRoleAssignedException
- when trying to unset service flag from a user with service only role
-
updateNameTitles
User updateNameTitles(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Updates titles before/after name of user.New titles must be set inside User object. Setting any title to null will remove title from name. Other user's properties are ignored.
- Parameters:
perunSession
-user
-- Returns:
- updated user with new titles before/after name
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
updateUser
User updateUser(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException Updates users data in DB.- Parameters:
perunSession
-user
-- Returns:
- updated user
- Throws:
InternalErrorException
UserNotExistsException
PrivilegeException
-
updateUserExtSource
UserExtSource updateUserExtSource(PerunSession perunSession, UserExtSource userExtSource) throws UserExtSourceNotExistsException, UserExtSourceExistsException, PrivilegeException Updates user's userExtSource in DB. Login and LoA can be updated this way.- Parameters:
perunSession
-userExtSource
-- Returns:
- updated userExtSource
- Throws:
InternalErrorException
PrivilegeException
UserExtSourceExistsException
- When UES with same login/extSource already exists.UserExtSourceNotExistsException
- When UES by its ID doesn't exists
-
updateUserExtSourceLastAccess
void updateUserExtSourceLastAccess(PerunSession perunSession, UserExtSource userExtSource) throws PrivilegeException, UserExtSourceNotExistsException Updates user's userExtSource last access time in DB. We can get information which userExtSource has been used as a last one.- Parameters:
perunSession
-userExtSource
-- Throws:
InternalErrorException
PrivilegeException
UserExtSourceNotExistsException
-
validatePassword
void validatePassword(PerunSession sess, String userLogin, String loginNamespace) throws PasswordCreationFailedException, PrivilegeException, InvalidLoginException Validates the password in external system and sets user extSources and extSource related attributes. User must not exist.- Parameters:
sess
- Perun sessionuserLogin
- String representation of the userLoginloginNamespace
- Login-namespace to validate password in- Throws:
InternalErrorException
PasswordCreationFailedException
InvalidLoginException
- When login of user has invalid syntax (is not allowed)PrivilegeException
-
validatePassword
void validatePassword(PerunSession sess, User user, String loginNamespace) throws PasswordCreationFailedException, PrivilegeException, UserNotExistsException, LoginNotExistsException, InvalidLoginException Validates the password in external system and sets user extSources and extSource related attributes. User must exist. User's login for specified namespace must exist in Perun.- Parameters:
sess
- Perun sessionuser
- User whose password should being validatedloginNamespace
- Login-namespace to validate password in- Throws:
InternalErrorException
PasswordCreationFailedException
UserNotExistsException
- When the user doesn't existLoginNotExistsException
- When user doesn't have login in specified namespacePrivilegeException
InvalidLoginException
-
validatePreferredEmailChange
String validatePreferredEmailChange(PerunSession sess, User user, UUID token) throws PrivilegeException, UserNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, WrongReferenceAttributeValueException, WrongAttributeValueException Validate change of user's preferred email address. New email address is set as value of urn:perun:user:attribute-def:def:preferredMail attribute.- Parameters:
sess
- PerunSessionuser
- User to validate email address fortoken
- token for the email change request to validate- Returns:
- String return new preferred email
- Throws:
InternalErrorException
PrivilegeException
UserNotExistsException
WrongAttributeAssignmentException
AttributeNotExistsException
WrongReferenceAttributeValueException
WrongAttributeValueException
-
validateSSHKey
Validate ssh public key, throws exception if validation fails- Parameters:
sess
- sesssshKey
- ssh public key to verify- Throws:
SSHKeyNotValidException
- when validation fails
-
changeOrganization
void changeOrganization(PerunSession sess, User user, String newOrganizationName) throws UserNotExistsException, PrivilegeException, UserExtSourceNotExistsException, PersonalDataChangeNotEnabledException Change organization from which user came to organization from user ext source.- Parameters:
sess
- sessionuser
- usernewOrganizationName
- new organization name- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of organization to organization from ues is not enabled.UserExtSourceNotExistsException
- If user ext source with given organization name and required loa does not exist.
-
changeOrganizationCustom
void changeOrganizationCustom(PerunSession sess, User user, String newOrganizationName) throws UserNotExistsException, PrivilegeException, PersonalDataChangeNotEnabledException Change organization from which user came to custom organization. If check from admin is required, then UserOrganizationChangeRequested audit log will be created. Otherwise, it will be set immediately.- Parameters:
sess
- sessionuser
- usernewOrganizationName
- new organization name- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of organization to custom organization is not enabled.
-
changeName
void changeName(PerunSession sess, User user, String newUserName) throws UserNotExistsException, PrivilegeException, UserExtSourceNotExistsException, PersonalDataChangeNotEnabledException Change user's name to user's name from user ext source.- Parameters:
sess
- sessionuser
- usernewUserName
- new user's name- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of user's name to user's name from ues is not enabled.UserExtSourceNotExistsException
- If user ext source with given user's name and required loa does not exist.
-
changeNameCustom
void changeNameCustom(PerunSession sess, User user, String titleBefore, String firstName, String middleName, String lastName, String titleAfter) throws UserNotExistsException, PrivilegeException, PersonalDataChangeNotEnabledException Change user's name to custom name. If check from admin is required, then UserNameChangeRequest audit log will be created. Otherwise, it will be set immediately.- Parameters:
sess
- sessionuser
- usertitleBefore
- new title beforefirstName
- new first namemiddleName
- new middle namelastName
- new last nametitleAfter
- new title after- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of user's name to custom name is not enabled.
-
changeEmail
void changeEmail(PerunSession sess, User user, String newEmail) throws UserNotExistsException, PrivilegeException, UserExtSourceNotExistsException, PersonalDataChangeNotEnabledException Change user's email to email from user ext source.- Parameters:
sess
- sessionuser
- usernewEmail
- new email- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of user's email to email from ues is not enabled.UserExtSourceNotExistsException
- If user ext source with given email and required loa does not exist.
-
changeEmailCustom
void changeEmailCustom(PerunSession sess, User user, String newEmail, String url, String lang, String path, String idp) throws UserNotExistsException, PrivilegeException, PersonalDataChangeNotEnabledException Change user's email to custom email. If verification is required, then verification email will be sent. Otherwise, it will be set immediately.- Parameters:
sess
- sessionuser
- usernewEmail
- new emailurl
- base URL of running perun instance passed from RPC.lang
- Language to get confirmation mail in (optional)path
- path that is appended to the url of the verification link (optional)idp
- authentication method appended to query parameters of verification link (optional)- Throws:
UserNotExistsException
- If user does not exist.PrivilegeException
- if privileges are not given.PersonalDataChangeNotEnabledException
- If change of user's email to custom email is not enabled.
-
getUserRelations
Map<String,List<PerunBean>> getUserRelations(PerunSession sess, User user) throws UserNotExistsException Gets map with 2 items which are a list of all vos and a list of all groups where given user is member filtered by principal's privileges.- Parameters:
sess
- perun sessionuser
- user- Returns:
- Result map with lists of vos and groups where given user is member
- Throws:
UserNotExistsException
- If user does not exist.
-