public final class DefaultUserRoleImpl extends AbstractUserRolePluginHelper
Modifier and Type | Field and Description |
---|---|
private static String |
AUTHOR
Plugin author.
|
private Map<String,String> |
conf
Configuration file.
|
private boolean |
configured
Status of the plugin configuration.
|
private DOIDbDataAccessService |
das
Database access.
|
private static String |
DESCRIPTION
Plugin description.
|
private static String |
LICENSE
Plugin license.
|
private static org.apache.logging.log4j.Logger |
LOG
Logger.
|
private String |
NAME
Class name.
|
private Map<String,Integer> |
options
Options for JDBC.
|
private static String |
OWNER
Plugin owner.
|
private MyMemoryRealm |
REALM
User/Role realm
|
private static String |
VERSION
Plugin version.
|
ADD_USER_NOTIFICATION, REMOVE_USER_NOTIFICATION
Constructor and Description |
---|
DefaultUserRoleImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
addDOIUser(String username,
Boolean admin)
Add a DOI user
|
boolean |
addDOIUser(String username,
Boolean admin,
String email)
Add a DOI user
|
boolean |
addUserToRole(String user,
int role)
Adds an user to a specific role.
|
String |
getAuthor()
Returns the author of the plugin.
|
String |
getDescription()
Returns the description of the plugin
|
String |
getLicense()
Returns the license of the plugin.
|
String |
getName()
Returns the name of the plugin.
|
String |
getOwner()
Returns the owner of the plugin.
|
List<DOIUser> |
getUsers()
Returns the allowed users for authentication.
|
List<DOIUser> |
getUsersFromRole(int roleName)
Get users from a specific role.
|
String |
getVersion()
Returns the version of the plugin.
|
void |
initConnection()
Inits the connection
|
boolean |
isConfigured()
Checks if the plugin is already configured
|
static boolean |
isPassword(String key)
Checks if the keyword is a password.
|
boolean |
isUserExist(String username)
Tests if the user exists.
|
void |
release()
Release the plugin.
|
boolean |
removeDOIUser(String username)
Removes the user
|
boolean |
removeUserToRole(String user,
int role)
Removes an user from a specific role.
|
void |
setConfiguration(Object configuration)
Sets the configuration.
|
boolean |
setUserToAdminGroup(String user)
Add user to Administrators group
|
private void |
setUserToAdminGroupInDB(String user)
Sets the user to the admin group.
|
boolean |
unsetUserFromAdminGroup(String user)
Remove user to Administrators group
|
StringBuilder |
validate()
Validates the parameters in the configuration file.
|
getRealm
private static final String DESCRIPTION
private static final String VERSION
private static final String OWNER
private static final String AUTHOR
private static final String LICENSE
private static final org.apache.logging.log4j.Logger LOG
private final String NAME
private final MyMemoryRealm REALM
private DOIDbDataAccessService das
private boolean configured
public void setConfiguration(Object configuration)
configuration
- configuration parameterspublic void initConnection() throws DoiRuntimeException
DoiRuntimeException
- When an connection error happenspublic List<DOIUser> getUsers() throws DOIDbException
getUsers
in class AbstractUserRoleDBHelper
DOIDbException
- When an error occurspublic List<DOIUser> getUsersFromRole(int roleName) throws DOIDbException
getUsersFromRole
in class AbstractUserRoleDBHelper
roleName
- role nameDOIDbException
- When an error occurspublic boolean addUserToRole(String user, int role)
addUserToRole
in class AbstractUserRoleDBHelper
user
- user to addrole
- rolepublic boolean removeUserToRole(String user, int role)
removeUserToRole
in class AbstractUserRoleDBHelper
user
- user to removerole
- roleprivate void setUserToAdminGroupInDB(String user) throws DOIDbException
user
- usernameDOIDbException
- - if a Database error occurspublic boolean setUserToAdminGroup(String user)
setUserToAdminGroup
in class AbstractUserRoleDBHelper
user
- user to addpublic boolean unsetUserFromAdminGroup(String user)
unsetUserFromAdminGroup
in class AbstractUserRoleDBHelper
user
- user to addpublic boolean isUserExist(String username)
isUserExist
in class AbstractUserRoleDBHelper
username
- the userpublic boolean addDOIUser(String username, Boolean admin)
addDOIUser
in class AbstractUserRoleDBHelper
username
- usernameadmin
- True when the user must be added in the admin group
otherwise Falsepublic boolean addDOIUser(String username, Boolean admin, String email)
addDOIUser
in class AbstractUserRoleDBHelper
username
- usernameadmin
- True when the user must be added in the admin group
otherwise Falseemail
- emailpublic boolean removeDOIUser(String username)
removeDOIUser
in class AbstractUserRoleDBHelper
username
- userpublic String getName()
public String getDescription()
public String getVersion()
public String getAuthor()
public String getOwner()
public String getLicense()
public StringBuilder validate()
public static boolean isPassword(String key)
key
- keyword to checkpublic void release()
public boolean isConfigured()
Copyright © 2017–2020 CNES. All rights reserved.