@Service @Transactional public class AccountServiceImpl extends java.lang.Object implements AccountService
| Constructor and Description |
|---|
AccountServiceImpl(RoleRepository roleRepository,
RolesService rolesService,
AccountRepository accountRepository,
AccountGroupRepository accountGroupRepository,
SecurityService securityService,
AuthenticationSourceService authenticationSourceService,
org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) |
| Modifier and Type | Method and Description |
|---|---|
Account |
create(AccountInput input)
Creates a built-in account
|
Account |
create(AccountInput input,
java.lang.String authenticationSourceMode)
Creates an account and allows for further customisation
|
AccountGroup |
createGroup(NameDescription nameDescription)
Creation of an account group
|
Ack |
deleteAccount(ID accountId)
Deletes an account
|
Ack |
deleteGlobalPermission(PermissionTargetType type,
int id)
Deletes a permission
|
Ack |
deleteGroup(ID groupId)
Deleting a group.
|
Ack |
deleteProjectPermission(ID projectId,
PermissionTargetType type,
int id)
Deletes a project permission.
|
java.util.Collection<AccountGroup> |
findAccountGroupsByGlobalRole(GlobalRole globalRole)
List of groups having the given global role
|
java.util.Collection<AccountGroup> |
findAccountGroupsByProjectRole(Project project,
ProjectRole projectRole)
List of groups having the given project role
|
java.util.Collection<Account> |
findAccountsByGlobalRole(GlobalRole globalRole)
List of accounts having the given global role
|
java.util.Collection<Account> |
findAccountsByProjectRole(Project project,
ProjectRole projectRole)
List of accounts having the given project role
|
java.util.Optional<Account> |
findUserByNameAndSource(java.lang.String username,
AuthenticationSourceProvider sourceProvider)
Looks for an account using its user name and his authentication source.
|
Account |
getAccount(ID accountId)
Gets an account using its ID
|
AccountGroup |
getAccountGroup(ID groupId)
Getting a group
|
java.util.List<AccountGroup> |
getAccountGroups()
List of account groups
|
java.util.List<AccountGroupSelection> |
getAccountGroupsForSelection(ID accountId)
Returns the list of all account groups, together with the status for their selection
in the given account ID.
|
java.util.List<Account> |
getAccounts()
List of accounts
|
java.util.List<Account> |
getAccountsForGroup(AccountGroup accountGroup)
Gets the list of accounts associated with this account group.
|
java.util.Collection<GlobalPermission> |
getGlobalPermissions()
Gets the list of global permissions.
|
java.util.Optional<GlobalRole> |
getGlobalRoleForAccount(Account account)
Gets the optional global role for an account
|
java.util.Optional<GlobalRole> |
getGlobalRoleForAccountGroup(AccountGroup group)
Gets the optional global role for an account group.
|
java.util.Collection<ProjectPermission> |
getProjectPermissions(ID projectId)
Gets the list of permissions for a project.
|
java.util.Collection<ProjectRoleAssociation> |
getProjectPermissionsForAccount(Account account)
Gets the list of project permissions for a given account
|
java.util.Collection<ProjectRoleAssociation> |
getProjectPermissionsForAccountGroup(AccountGroup group)
Gets the list of project permissions for a given account group
|
protected AccountGroup |
groupWithACL(AccountGroup group) |
Ack |
saveGlobalPermission(PermissionTargetType type,
int id,
PermissionInput input)
|
Ack |
saveProjectPermission(ID projectId,
PermissionTargetType type,
int id,
PermissionInput input)
|
java.util.Collection<PermissionTarget> |
searchPermissionTargets(java.lang.String token)
Searches for a list of permission targets using the
token as a part in the
name of the permission target. |
void |
setAccountGroupContributors(java.util.Collection<AccountGroupContributor> accountGroupContributors) |
Account |
updateAccount(ID accountId,
AccountInput input)
Updating an existing account
|
AccountGroup |
updateGroup(ID groupId,
NameDescription input)
Updating a group
|
Account |
withACL(AuthenticatedAccount raw)
Completes an account with the list of its authorisations.
|
@Autowired public AccountServiceImpl(RoleRepository roleRepository, RolesService rolesService, AccountRepository accountRepository, AccountGroupRepository accountGroupRepository, SecurityService securityService, AuthenticationSourceService authenticationSourceService, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
@Autowired(required=false) public void setAccountGroupContributors(java.util.Collection<AccountGroupContributor> accountGroupContributors)
public Account withACL(AuthenticatedAccount raw)
AccountServicewithACL in interface AccountServiceraw - Account without authorisationspublic java.util.List<Account> getAccounts()
AccountServicegetAccounts in interface AccountServicepublic Account create(AccountInput input)
AccountServicecreate in interface AccountServicepublic Account create(AccountInput input, java.lang.String authenticationSourceMode)
AccountServicecreate in interface AccountServiceinput - Account dataauthenticationSourceMode - Authentication modeAuthenticationSourceService.getAuthenticationSource(String)public java.util.Optional<Account> findUserByNameAndSource(java.lang.String username, AuthenticationSourceProvider sourceProvider)
AccountServicefindUserByNameAndSource in interface AccountServiceusername - User namesourceProvider - Provider of the sourcepublic Account updateAccount(ID accountId, AccountInput input)
AccountServiceupdateAccount in interface AccountServiceaccountId - ID of the account to updateinput - Update datapublic Ack deleteAccount(ID accountId)
AccountServicedeleteAccount in interface AccountServicepublic java.util.List<AccountGroup> getAccountGroups()
AccountServicegetAccountGroups in interface AccountServicepublic AccountGroup createGroup(NameDescription nameDescription)
AccountServicecreateGroup in interface AccountServicepublic AccountGroup getAccountGroup(ID groupId)
AccountServicegetAccountGroup in interface AccountServicepublic AccountGroup updateGroup(ID groupId, NameDescription input)
AccountServiceupdateGroup in interface AccountServicepublic Ack deleteGroup(ID groupId)
AccountServicedeleteGroup in interface AccountServicepublic java.util.List<AccountGroupSelection> getAccountGroupsForSelection(ID accountId)
AccountServiceset,
meaning that none of the groups will be selected.getAccountGroupsForSelection in interface AccountServiceaccountId - Account ID to get the groups for, or not setpublic java.util.Collection<PermissionTarget> searchPermissionTargets(java.lang.String token)
AccountServicetoken as a part in the
name of the permission target.searchPermissionTargets in interface AccountServicepublic Ack saveGlobalPermission(PermissionTargetType type, int id, PermissionInput input)
AccountServicesaveGlobalPermission in interface AccountServicepublic java.util.Collection<GlobalPermission> getGlobalPermissions()
AccountServicegetGlobalPermissions in interface AccountServicepublic Ack deleteGlobalPermission(PermissionTargetType type, int id)
AccountServicedeleteGlobalPermission in interface AccountServicepublic java.util.Collection<ProjectPermission> getProjectPermissions(ID projectId)
AccountServicegetProjectPermissions in interface AccountServiceprojectId - ID of the projectpublic Ack saveProjectPermission(ID projectId, PermissionTargetType type, int id, PermissionInput input)
AccountServicesaveProjectPermission in interface AccountServicepublic Ack deleteProjectPermission(ID projectId, PermissionTargetType type, int id)
AccountServicedeleteProjectPermission in interface AccountServicepublic java.util.Collection<ProjectRoleAssociation> getProjectPermissionsForAccount(Account account)
AccountServicegetProjectPermissionsForAccount in interface AccountServiceaccount - Account to get the permissions forpublic java.util.Optional<GlobalRole> getGlobalRoleForAccount(Account account)
AccountServicegetGlobalRoleForAccount in interface AccountServiceaccount - Accountpublic java.util.List<Account> getAccountsForGroup(AccountGroup accountGroup)
AccountServicegetAccountsForGroup in interface AccountServiceaccountGroup - Account grouppublic java.util.Optional<GlobalRole> getGlobalRoleForAccountGroup(AccountGroup group)
AccountServicegetGlobalRoleForAccountGroup in interface AccountServicegroup - Account grouppublic java.util.Collection<ProjectRoleAssociation> getProjectPermissionsForAccountGroup(AccountGroup group)
AccountServicegetProjectPermissionsForAccountGroup in interface AccountServicegroup - Account group to get the permissions forpublic java.util.Collection<AccountGroup> findAccountGroupsByGlobalRole(GlobalRole globalRole)
AccountServicefindAccountGroupsByGlobalRole in interface AccountServiceglobalRole - Global role to search forpublic java.util.Collection<Account> findAccountsByGlobalRole(GlobalRole globalRole)
AccountServicefindAccountsByGlobalRole in interface AccountServiceglobalRole - Global role to search forpublic java.util.Collection<AccountGroup> findAccountGroupsByProjectRole(Project project, ProjectRole projectRole)
AccountServicefindAccountGroupsByProjectRole in interface AccountServiceproject - ProjectprojectRole - Role to search forpublic java.util.Collection<Account> findAccountsByProjectRole(Project project, ProjectRole projectRole)
AccountServicefindAccountsByProjectRole in interface AccountServiceproject - ProjectprojectRole - Role to search forpublic Account getAccount(ID accountId)
AccountServicegetAccount in interface AccountServiceprotected AccountGroup groupWithACL(AccountGroup group)