@ApplicationScoped public class AccountServiceImpl extends Object implements AccountService
Constructor and Description |
---|
AccountServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addRole(UserAccount account,
String role)
Add a single role to the roles of the given
UserAccount |
boolean |
checkPassword(String login,
String passwd)
Check the credentials for the given login
|
boolean |
checkPassword(UserAccount account,
String passwd)
Check the credentials for the given
UserAccount |
UserAccount |
createAccount(String login)
Create an user account
|
UserAccount |
createAccount(String login,
String firstName,
String lastName)
Create an user account and set first- and lastName in the user profile (foaf)
|
void |
createDefaultAccounts()
Create the default accounts, currently only admin
|
void |
deleteAccount(UserAccount account)
Deletes the given user account.
|
UserAccount |
getAccount(org.apache.marmotta.platform.core.model.user.MarmottaUser user)
Retrieve the user account for a given
MarmottaUser (facaded user resource) |
UserAccount |
getAccount(String login)
Retrieve the user account for the given login name
|
UserAccount |
getAccount(org.openrdf.model.URI resource)
Retrieve the user account for the given (User)-Resource
|
Set<String> |
getRoles(UserAccount account)
Retrieve the roles for the given
UserAccount |
boolean |
hasRole(UserAccount account,
String role)
Check whether the given
UserAccount has the role in question. |
void |
initialize() |
List<UserAccount> |
listAccounts()
List all
UserAccount . |
List<UserAccount> |
listAccounts(String role)
Returns a
List of UserAccount that have the given role associated. |
void |
onConfigurationChange(org.apache.marmotta.platform.core.events.ConfigurationChangedEvent event) |
void |
removeRole(UserAccount account,
String role)
Remove a single role from the roles of the given
UserAccount |
UserAccount |
setPassword(UserAccount account,
String passwd)
Update/Set the password for the given
UserAccount |
void |
setRoles(UserAccount account,
Set<String> roles)
Set the roles for the given
UserAccount |
void |
systemStartup(org.apache.marmotta.platform.core.events.SystemStartupEvent event) |
@PostConstruct public void initialize()
public void systemStartup(@Observes org.apache.marmotta.platform.core.events.SystemStartupEvent event)
public void onConfigurationChange(@Observes org.apache.marmotta.platform.core.events.ConfigurationChangedEvent event)
public void createDefaultAccounts()
AccountService
createDefaultAccounts
in interface AccountService
public List<UserAccount> listAccounts()
AccountService
UserAccount
.listAccounts
in interface AccountService
List
of all UserAccount
public List<UserAccount> listAccounts(String role)
AccountService
List
of UserAccount
that have the given role associated.listAccounts
in interface AccountService
role
- the role(-name)List
of UserAccount
that have the given role associated.public UserAccount createAccount(String login)
AccountService
createAccount
in interface AccountService
login
- the unique username/loginUserAccount
public UserAccount createAccount(String login, String firstName, String lastName)
AccountService
createAccount
in interface AccountService
login
- the unique username/login (also foaf:nick)firstName
- the value for foaf:firstName, may be nulllastName
- the value for foaf:lastName, may be nullUserAccount
public void deleteAccount(UserAccount account)
AccountService
deleteAccount
in interface AccountService
account
- the UserAccount
to delete.public UserAccount getAccount(String login)
AccountService
getAccount
in interface AccountService
login
- the login nameUserAccount
for the given login namepublic UserAccount getAccount(org.openrdf.model.URI resource)
AccountService
getAccount
in interface AccountService
resource
- the user resource (foaf:person)UserAccount
, or null
if no account present.public UserAccount getAccount(org.apache.marmotta.platform.core.model.user.MarmottaUser user)
AccountService
MarmottaUser
(facaded user resource)getAccount
in interface AccountService
user
- the MarmottaUser
UserAccount
, of null
if none present.AccountService.getAccount(org.openrdf.model.URI)
public UserAccount setPassword(UserAccount account, String passwd)
AccountService
UserAccount
setPassword
in interface AccountService
account
- the UserAccount
to modifypasswd
- the new passwordUserAccount
public boolean checkPassword(UserAccount account, String passwd)
AccountService
UserAccount
checkPassword
in interface AccountService
account
- the UserAccount
to authenticatepasswd
- the password (plain)true
if the password matched the password of the UserAccount
public boolean checkPassword(String login, String passwd)
AccountService
checkPassword
in interface AccountService
login
- the login/account name/user namepasswd
- the password (plain)true
if the password matched the logins' UserAccount
passwordpublic void setRoles(UserAccount account, Set<String> roles)
AccountService
UserAccount
setRoles
in interface AccountService
account
- the UserAccount
to modifyroles
- the roles (names) of the accountUserAccount.setRoles(Set)
public Set<String> getRoles(UserAccount account)
AccountService
UserAccount
getRoles
in interface AccountService
account
- the UserAccount
Set
containing the role-names of the given UserAccount
UserAccount.getRoles()
public void addRole(UserAccount account, String role)
AccountService
UserAccount
addRole
in interface AccountService
account
- the UserAccount
to modifyrole
- the role(-name) to addpublic void removeRole(UserAccount account, String role)
AccountService
UserAccount
removeRole
in interface AccountService
account
- the UserAccount
to modifyrole
- the role(-name) to removepublic boolean hasRole(UserAccount account, String role)
AccountService
UserAccount
has the role in question.hasRole
in interface AccountService
account
- the UserAccount
to queryrole
- the role(-name) in question.UserAccount
has the role in questionCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.