@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)
AccountService
withACL
in interface AccountService
raw
- Account without authorisationspublic java.util.List<Account> getAccounts()
AccountService
getAccounts
in interface AccountService
public Account create(AccountInput input)
AccountService
create
in interface AccountService
public Account create(AccountInput input, java.lang.String authenticationSourceMode)
AccountService
create
in interface AccountService
input
- Account dataauthenticationSourceMode
- Authentication modeAuthenticationSourceService.getAuthenticationSource(String)
public java.util.Optional<Account> findUserByNameAndSource(java.lang.String username, AuthenticationSourceProvider sourceProvider)
AccountService
findUserByNameAndSource
in interface AccountService
username
- User namesourceProvider
- Provider of the sourcepublic Account updateAccount(ID accountId, AccountInput input)
AccountService
updateAccount
in interface AccountService
accountId
- ID of the account to updateinput
- Update datapublic Ack deleteAccount(ID accountId)
AccountService
deleteAccount
in interface AccountService
public java.util.List<AccountGroup> getAccountGroups()
AccountService
getAccountGroups
in interface AccountService
public AccountGroup createGroup(NameDescription nameDescription)
AccountService
createGroup
in interface AccountService
public AccountGroup getAccountGroup(ID groupId)
AccountService
getAccountGroup
in interface AccountService
public AccountGroup updateGroup(ID groupId, NameDescription input)
AccountService
updateGroup
in interface AccountService
public Ack deleteGroup(ID groupId)
AccountService
deleteGroup
in interface AccountService
public java.util.List<AccountGroupSelection> getAccountGroupsForSelection(ID accountId)
AccountService
set
,
meaning that none of the groups will be selected.getAccountGroupsForSelection
in interface AccountService
accountId
- Account ID to get the groups for, or not set
public java.util.Collection<PermissionTarget> searchPermissionTargets(java.lang.String token)
AccountService
token
as a part in the
name of the permission target.searchPermissionTargets
in interface AccountService
public Ack saveGlobalPermission(PermissionTargetType type, int id, PermissionInput input)
AccountService
saveGlobalPermission
in interface AccountService
public java.util.Collection<GlobalPermission> getGlobalPermissions()
AccountService
getGlobalPermissions
in interface AccountService
public Ack deleteGlobalPermission(PermissionTargetType type, int id)
AccountService
deleteGlobalPermission
in interface AccountService
public java.util.Collection<ProjectPermission> getProjectPermissions(ID projectId)
AccountService
getProjectPermissions
in interface AccountService
projectId
- ID of the projectpublic Ack saveProjectPermission(ID projectId, PermissionTargetType type, int id, PermissionInput input)
AccountService
saveProjectPermission
in interface AccountService
public Ack deleteProjectPermission(ID projectId, PermissionTargetType type, int id)
AccountService
deleteProjectPermission
in interface AccountService
public java.util.Collection<ProjectRoleAssociation> getProjectPermissionsForAccount(Account account)
AccountService
getProjectPermissionsForAccount
in interface AccountService
account
- Account to get the permissions forpublic java.util.Optional<GlobalRole> getGlobalRoleForAccount(Account account)
AccountService
getGlobalRoleForAccount
in interface AccountService
account
- Accountpublic java.util.List<Account> getAccountsForGroup(AccountGroup accountGroup)
AccountService
getAccountsForGroup
in interface AccountService
accountGroup
- Account grouppublic java.util.Optional<GlobalRole> getGlobalRoleForAccountGroup(AccountGroup group)
AccountService
getGlobalRoleForAccountGroup
in interface AccountService
group
- Account grouppublic java.util.Collection<ProjectRoleAssociation> getProjectPermissionsForAccountGroup(AccountGroup group)
AccountService
getProjectPermissionsForAccountGroup
in interface AccountService
group
- Account group to get the permissions forpublic java.util.Collection<AccountGroup> findAccountGroupsByGlobalRole(GlobalRole globalRole)
AccountService
findAccountGroupsByGlobalRole
in interface AccountService
globalRole
- Global role to search forpublic java.util.Collection<Account> findAccountsByGlobalRole(GlobalRole globalRole)
AccountService
findAccountsByGlobalRole
in interface AccountService
globalRole
- Global role to search forpublic java.util.Collection<AccountGroup> findAccountGroupsByProjectRole(Project project, ProjectRole projectRole)
AccountService
findAccountGroupsByProjectRole
in interface AccountService
project
- ProjectprojectRole
- Role to search forpublic java.util.Collection<Account> findAccountsByProjectRole(Project project, ProjectRole projectRole)
AccountService
findAccountsByProjectRole
in interface AccountService
project
- ProjectprojectRole
- Role to search forpublic Account getAccount(ID accountId)
AccountService
getAccount
in interface AccountService
protected AccountGroup groupWithACL(AccountGroup group)