public class MetadataSecurityOps extends java.lang.Object implements CustomSecurityOps
setuserid and
userid functions. If a user is exclusive-locking the _user table, another one
can get/set userid for the same database. However, attempting to execute a FIND query on the
_user meta-table it will be put on hold until the first user releases the lock.
TODO:
Err 709: "-P and -U startup parameters require _User file records."| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
META_TABLE_USER
Constant used for accessing the converted _User meta-table.
|
private static java.util.Map<java.lang.String,java.lang.String> |
metaFieldDomain
The domain field name, per ldb.
|
private static java.util.Map<java.lang.String,java.lang.String> |
metaFieldPassword
The password field name, per ldb.
|
private static java.util.Map<java.lang.String,java.lang.String> |
metaFieldUserId
The user ID field name, per ldb.
|
| Constructor and Description |
|---|
MetadataSecurityOps() |
| Modifier and Type | Method and Description |
|---|---|
int |
getAuthLevel(java.lang.String ldbname)
Check the access level for a database.
|
static java.lang.String |
getMetaFieldDomain(java.lang.String ldbName)
Compute the name of the domain field, depending if the conversion for this ldb is minimal or not.
|
static java.lang.String |
getMetaFieldPassword(java.lang.String ldbName)
Compute the name of the password field, depending if the conversion for this ldb is minimal or not.
|
static java.lang.String |
getMetaFieldUserid(java.lang.String ldbName)
Compute the name of the user ID field, depending if the conversion for this ldb is minimal or not.
|
java.lang.String |
getUserId()
Returns the userid associated with the current connected database.
|
java.lang.String |
getUserIdFromDB(java.lang.String dbname)
Returns the userid associated with the current user of the given logical database.
|
boolean |
hasAccessToDatabase(java.lang.String ldbName)
Checks if the currently authenticated user has access to a database.
|
boolean |
setUserId(java.lang.String userid,
java.lang.String password)
Authenticates the user for specified DB connection.
|
boolean |
setUserId(java.lang.String userid,
java.lang.String password,
java.lang.String dbname)
Authenticates the user for specified DB connection.
|
void |
setUserIdDirect(java.lang.String userid,
java.lang.String dbname,
boolean lock)
Sets the specified user ID directly, without authentication, for the given database.
|
public static final java.lang.String META_TABLE_USER
private static java.util.Map<java.lang.String,java.lang.String> metaFieldUserId
private static java.util.Map<java.lang.String,java.lang.String> metaFieldDomain
private static java.util.Map<java.lang.String,java.lang.String> metaFieldPassword
public static java.lang.String getMetaFieldUserid(java.lang.String ldbName)
public static java.lang.String getMetaFieldDomain(java.lang.String ldbName)
public static java.lang.String getMetaFieldPassword(java.lang.String ldbName)
public java.lang.String getUserId()
getUserId in interface CustomSecurityOpspublic java.lang.String getUserIdFromDB(java.lang.String dbname)
getUserIdFromDB in interface CustomSecurityOpsdbname - Logical database name.unknown parameter is
provided the method returns unknown value.public boolean setUserId(java.lang.String userid,
java.lang.String password)
setUserId in interface CustomSecurityOpsuserid - The name of the user to set as UserID.password - The users password.true in case of valid user match false otherwise.public boolean setUserId(java.lang.String userid,
java.lang.String password,
java.lang.String dbname)
ENCODE
to password string it is compared to existing record from database in case
sensitive, taking into consideration trailing spaces
setUserId in interface CustomSecurityOpsuserid - The name of the user to set as UserID.password - The users password.dbname - Logical database name.true in case of valid user match false otherwise.public void setUserIdDirect(java.lang.String userid,
java.lang.String dbname,
boolean lock)
setUserIdDirect in interface CustomSecurityOpsuserid - The name of the user to set as UserID.dbname - Logical database name.lock - Flag indicating that the database should be lockedpublic int getAuthLevel(java.lang.String ldbname)
getAuthLevel in interface CustomSecurityOpsldbname - The logical database name to query.public boolean hasAccessToDatabase(java.lang.String ldbName)
If the database does not have any users defined in _user meta table the authentication is not enforced so any user can access it. Otherwise, the user must have entered a correct combination of userid / password to get access to respective database.
hasAccessToDatabase in interface CustomSecurityOpsldbName - The logical name of the database.true if access to requested database is granted