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_FIELD_PASSWORD
Constant used for accessing the _password field of converted _User meta-table.
|
static java.lang.String |
META_FIELD_USERID
Constant used for accessing the _userid field of converted _User meta-table.
|
static java.lang.String |
META_TABLE_USER
Constant used for accessing the converted _User meta-table.
|
Constructor and Description |
---|
MetadataSecurityOps() |
Modifier and Type | Method and Description |
---|---|
int |
getAuthLevel(java.lang.String ldbname)
Check the access level for a database.
|
private java.lang.String |
getDefaultDatabase()
Returns the currently defined default database.
|
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.
|
public static final java.lang.String META_TABLE_USER
public static final java.lang.String META_FIELD_USERID
public static final java.lang.String META_FIELD_PASSWORD
private java.lang.String getDefaultDatabase()
SETUSERID/USERID functions require one connected db or db argument (691).if the program contains calls to USERID/SETUSERID.
public java.lang.String getUserId()
getUserId
in interface CustomSecurityOps
public java.lang.String getUserIdFromDB(java.lang.String dbname)
getUserIdFromDB
in interface CustomSecurityOps
dbname
- Logical database name.public boolean setUserId(java.lang.String userid, java.lang.String password)
setUserId
in interface CustomSecurityOps
userid
- 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 CustomSecurityOps
userid
- 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 int getAuthLevel(java.lang.String ldbname)
getAuthLevel
in interface CustomSecurityOps
ldbname
- 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 CustomSecurityOps
ldbName
- The logical name of the database.true
if access to requested database is granted