Package com.avoka.tm.svc
Class UserBuilder
java.lang.Object
com.avoka.tm.svc.UserBuilder
Provides a User value object builder class.
Examples
Please find the user builder examples below.
Create a User
This example shows how to create a User
object.
import com.avoka.tm.svc.* import com.avoka.tm.vo.* User user = new UserBuilder("Work Space") .setEmail("[email protected]") .setUserType(User.TYPE_LOCAL) .setLoginName("login") .setPassword("secret!23") .create()
Update a User's Email Address
This example shows how to update an user's email address.
import com.avoka.tm.svc.* import com.avoka.tm.vo.* User user = new UserBuilder(request) .setLoginName("dsmith") .setEmail("[email protected]") .update()
Create/Update a User
The example below shows how to create or update an 'SSO' type user.
import com.avoka.tm.svc.* import com.avoka.tm.vo.* User user = new UserBuilder(request) .setLoginName("dsmith") .setEmail("[email protected]") .setUserType(User.TYPE_SSO) .createOrUpdate()
Unlock a temporarily locked User
The example below shows how to unlock an existing user. For a user to be successfully unlocked the account must be in Locked Temporarily status and the Lockout End Time passed
import com.avoka.tm.svc.* import com.avoka.tm.vo.* User user = new UserBuilder(request) .setLoginName("dsmith") .setEmail("[email protected]") .withUpdatedLockStatus() .update()
- Since:
- 5.0.0
-
Constructor Summary
ConstructorDescriptionCreate a User service objectUserBuilder
(jakarta.servlet.http.HttpServletRequest request) Create a User service object with the given request.UserBuilder
(String spaceName) Create a User service object with the given request. -
Method Summary
Modifier and TypeMethodDescriptionaddGroupName
(String groupName) Add the group names the user should be assigned to.addOrgName
(String orgName) Add the organization name the user should be associated with.addRoleName
(String roleName) Add the role name the user should be assigned to.addSpaceName
(String spaceName) Add the form space names the user should be assigned to.create()
Create a new User account based on the specified parameter and return the new User value object.Create or update the user account specified by the given parameters, and return current User value object.removeGroupName
(String groupName) Remove the group names the user should be assigned to.removeOrgName
(String orgName) Remove the organization name the user should be associated with.removeRoleName
(String roleName) Remove the role name the user should be assigned to.removeSpaceName
(String spaceName) Remove the form space names the user should be assigned to.setAccountStatus
(String accountStatus) Set the user account status parameter [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ].setChangePassword
(boolean isChangePassword) Set the flag to force the user to update their password on next login.Set the user email parameter.setFirstName
(String firstName) Set the user first name parameter.setGroupNames
(Set<String> groupNames) Set the group names the user should be assigned to.setLastName
(String lastName) Set the user last name parameter.setLoginName
(String loginName) Set the user login name parameter.Set the user mobile number parameter.setOrgNames
(Set<String> orgNames) Set the organization names the user should be associated with.setPassword
(String password) Set the user password, only applicable for "Local" type users and not for LDAP or SSO user types.setProfileMap
(Map<String, String> profileMap) Set the user profile values map parameter.setRoleNames
(Set<String> roleNames) Set the role names the user should be assigned to.setSpaceNames
(Set<String> spaceNames) Set the form space names the user should be assigned to.void
setSvcSpaceName
(String svcSpaceName) Set the service form space name the builder will use.setUserType
(String userType) Set the user type parameter [ Local | LDAP | SSO ].update()
Update the user account specified by the loginName parameter and return the update User value object.Set the flag to unlock user if they were locked temporarily and the lockout duration has passed.
-
Constructor Details
-
UserBuilder
Create a User service object -
UserBuilder
@FluentSecurityPermission(permissions="user-edit") public UserBuilder(jakarta.servlet.http.HttpServletRequest request) Create a User service object with the given request.- Parameters:
request
- the servlet request
-
UserBuilder
Create a User service object with the given request.- Parameters:
spaceName
- the form space name request
-
-
Method Details
-
setLoginName
Set the user login name parameter.- Parameters:
loginName
- the user login name parameter- Returns:
- the user service
-
setAccountStatus
Set the user account status parameter [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ].- Parameters:
accountStatus
- the user account status parameter [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ]- Returns:
- the user service
-
setEmail
Set the user email parameter.- Parameters:
email
- the user email parameter- Returns:
- the user service
-
setFirstName
Set the user first name parameter.- Parameters:
firstName
- the user first name parameter- Returns:
- the user service
-
setLastName
Set the user last name parameter.- Parameters:
lastName
- the user last name parameter- Returns:
- the user service
-
setMobile
Set the user mobile number parameter.- Parameters:
mobile
- the user mobile number parameter- Returns:
- the user service
-
setPassword
Set the user password, only applicable for "Local" type users and not for LDAP or SSO user types.- Parameters:
password
- the user password to set- Returns:
- the user service
-
setChangePassword
Set the flag to force the user to update their password on next login.- Parameters:
isChangePassword
- true if you want to force the user to update their password next login- Returns:
- the user service
- Since:
- 19.11.0
-
setUserType
Set the user type parameter [ Local | LDAP | SSO ].- Parameters:
userType
- the user type parameter [ Local | LDAP | SSO ]- Returns:
- the user service
-
setProfileMap
Set the user profile values map parameter.- Parameters:
profileMap
- the user profile values map parameter- Returns:
- the user service
-
setGroupNames
@FluentSecurityPermission(permissions="group-assign") public UserBuilder setGroupNames(Set<String> groupNames) Set the group names the user should be assigned to.- Parameters:
groupNames
- the group names the user should be assigned to- Returns:
- the user service
-
addGroupName
@FluentSecurityPermission(permissions="group-assign") public UserBuilder addGroupName(String groupName) Add the group names the user should be assigned to.- Parameters:
groupName
- the group name the user should be assigned to- Returns:
- the user service
-
removeGroupName
@FluentSecurityPermission(permissions="group-assign") public UserBuilder removeGroupName(String groupName) Remove the group names the user should be assigned to.- Parameters:
groupName
- the group name the user should not be assigned to- Returns:
- the user service
-
setOrgNames
Set the organization names the user should be associated with.- Parameters:
orgNames
- the organization names the user should be associated with- Returns:
- the user service
-
addOrgName
Add the organization name the user should be associated with.- Parameters:
orgName
- the organization name the user should be associated with- Returns:
- the user service
-
removeOrgName
Remove the organization name the user should be associated with.- Parameters:
orgName
- the organization name the user should not be associated with- Returns:
- the user service
-
setRoleNames
@FluentSecurityPermission(permissions="role-assign") public UserBuilder setRoleNames(Set<String> roleNames) Set the role names the user should be assigned to.- Parameters:
roleNames
- the role names the user should be assigned to- Returns:
- the user service
-
addRoleName
@FluentSecurityPermission(permissions="role-assign") public UserBuilder addRoleName(String roleName) Add the role name the user should be assigned to.- Parameters:
roleName
- the role name the user should be assigned to- Returns:
- the user service
-
removeRoleName
@FluentSecurityPermission(permissions="role-assign") public UserBuilder removeRoleName(String roleName) Remove the role name the user should be assigned to.- Parameters:
roleName
- the role name the user should not be assigned to- Returns:
- the user service
-
setSpaceNames
Set the form space names the user should be assigned to.- Parameters:
spaceNames
- the form space names the user should be assigned to- Returns:
- the user service
-
addSpaceName
Add the form space names the user should be assigned to.- Parameters:
spaceName
- the form space name the user should be assigned to- Returns:
- the user service
-
removeSpaceName
Remove the form space names the user should be assigned to.- Parameters:
spaceName
- the form space name the user should not be assigned to- Returns:
- the user service
-
setSvcSpaceName
Set the service form space name the builder will use.- Parameters:
svcSpaceName
- svcSpaceName
-
withUpdatedLockStatus
Set the flag to unlock user if they were locked temporarily and the lockout duration has passed.- Returns:
- the user service
- Since:
- 19.11.0
-
create
Create a new User account based on the specified parameter and return the new User value object.- Returns:
- the newly created User value object
-
update
Update the user account specified by the loginName parameter and return the update User value object. This method will throw a IllegalArgumentException if the specified user specified by loginName parameter was not found.- Returns:
- the update User value object
-
createOrUpdate
Create or update the user account specified by the given parameters, and return current User value object. If the user specified by the loginName is not found then a new user account will be created.- Returns:
- create or update the user account specified by the given parameters, and return current User value object
-