public final class ACLUser extends DBPersist
Object mapping for k_users table registers
Modifier and Type | Field and Description |
---|---|
static short |
ClassId |
Constructor and Description |
---|
ACLUser()
Default constructor.
|
ACLUser(JDCConnection oConn,
java.lang.String sUserGUID)
Constructs ACLUser and load attributes from k_users table
|
ACLUser(java.lang.String sUserGUID)
Constructs ACLUser and set GUID
Does not load any fields from database.
|
Modifier and Type | Method and Description |
---|---|
int |
addToACLGroups(JDCConnection oConn,
java.lang.String sGroupList)
Add User to Groups.
|
boolean |
checkChallengeReply(JDCConnection oConn,
java.lang.String sReply)
Check whether the given reply matches the challenge question anwser
Comparison is case insensitive and ignores white spaces and accents
|
static boolean |
checkSignature(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sSign)
Checks if a given signature password matches the one previously assigned
|
int |
clearACLGroups(JDCConnection oConn)
Remove user from all security role groups
|
static java.lang.String |
create(JDCConnection oConn,
java.lang.Object[] Values)
Shortcut for creating a new user
|
static java.lang.String |
create(JDCConnection oConn,
java.lang.String sGuid,
java.lang.Object[] Values)
Shortcut for creating a new user with a given GUID
|
boolean |
delete(JDCConnection oConn)
Delete a register from database
The deleted register will be the one matching this DBPersist primary key,
as set at constructor or load() method.
|
static boolean |
delete(JDCConnection oConn,
java.lang.String sUserGUID)
Delete User
Categories owned by this user are also deleted, but other data and references for user are not checked.
|
DBSubset |
getAddresses(JDCConnection oConn)
Get Addresses associated with user at k_x_addr_user table.
|
static java.lang.String |
getEmailFromId(JDCConnection oConn,
java.lang.String sUserId)
Get User main e-mail from its GUID.
|
java.lang.String |
getFullName()
Get full name
|
DBSubset |
getGroups(JDCConnection oConn)
Get security role groups to witch this user belongs looking a k_x_group_user table.
|
static java.lang.String |
getIdFromEmail(java.sql.Connection oConn,
java.lang.String sUserEMail)
Get User Unique Id. from its main e-mail address.
|
static java.lang.String |
getIdFromEmail(JDCConnection oConn,
java.lang.String sUserEMail)
Get User Unique Id. from its main e-mail address.
|
static java.lang.String |
getIdFromNick(java.sql.Connection oConn,
int iDomainId,
java.lang.String sUserNick)
Get User Unique Id. from its nickname.
|
static java.lang.String |
getIdFromNick(java.sql.Connection oConn,
java.lang.String sUserNick)
Get User Unique Id. from its nickname.
|
static java.lang.String |
getIdFromNick(JDCConnection oConn,
int iDomainId,
java.lang.String sUserNick)
Get User Unique Id. from its nickname.
|
java.lang.String |
getMailFolder(JDCConnection oConn,
java.lang.String sFolderName)
Get GUID of user mail folder category
The Inbox category is where messages downloaded from the mail server are cached by default.
|
java.lang.String[] |
getMailFolderNames(JDCConnection oConn)
Get name of all user mail folders
|
java.lang.String[] |
getMailFolders(JDCConnection oConn)
Get GUID of all user mail folders
|
java.lang.String |
getMailRoot(JDCConnection oConn)
Get GUID of user mail root category
The user mail root category is always named DOMAIN_nickname_mail
at nm_category field of k_categories.
|
int |
getRolesForApplication(JDCConnection oConn,
int iIdApp,
java.lang.String sGuWorkArea)
Get roles of this user for a given application and workarea
|
boolean |
isAdminForApplication(JDCConnection oConn,
int iIdApp)
Find out if this user has administrator role in his default workarea over given application
|
boolean |
isAdminForApplication(JDCConnection oConn,
int iIdApp,
java.lang.String sGuWorkArea)
Find out if this user has administrator role over given application and workarea
|
boolean |
isDomainAdmin(JDCConnection oConn)
Find out is this user has administrator.
|
boolean |
isGuestForApplication(JDCConnection oConn,
int iIdApp)
Find out if this user has guest role in his default workarea over given application
|
boolean |
isPowerUserForApplication(JDCConnection oConn,
int iIdApp)
Find out if this user has power user role in his default workarea over given application
|
boolean |
isPowerUserForApplication(JDCConnection oConn,
int iIdApp,
java.lang.String sGuWorkArea)
Find out if this user has power user role over given application and workarea
|
boolean |
isUserForApplication(JDCConnection oConn,
int iIdApp)
Find out if this user has plain user role in his default workarea over given application
|
boolean |
isUserForApplication(JDCConnection oConn,
int iIdApp,
java.lang.String sGuWorkArea)
Find out if this user has plain user role over given application and workarea
|
int |
removeFromACLGroup(JDCConnection oConn,
java.lang.String sIdGroup)
Remove User from Group.
|
static boolean |
resetPassword(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sNewPwd)
Update tx_pwd password column at k_users table for given user
Password expiration is not modified
|
static boolean |
resetPassword(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sNewPwd,
java.util.Date dtExpire)
Update tx_pwd password column at k_users table for given user
|
static boolean |
resetPassword(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sNewPwd,
java.util.Date dtExpire,
DistributedCachePeer oCache)
Update tx_pwd password column at k_users table for given user
and remove it from memory cache if it was previously cached.
|
static boolean |
resetPassword(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sNewPwd,
DistributedCachePeer oCache)
Update tx_pwd password column at k_users table for given user
and remove it from memory cache if it was previously cached.
|
static boolean |
resetSignature(JDCConnection oConn,
java.lang.String sUserId,
java.lang.String sNewSign)
Change signature password and delete any previous entries encrypted with former password
|
boolean |
store(JDCConnection oConn)
Store ACLUser
If gu_user is not set then a new GUID is assigned.
|
static java.lang.String |
suggestNickForEmail(JDCConnection oConn,
java.lang.String sEmail)
Suggest a unique nick name for a given e-mail
If a user with given e-mail already exists at k_users table,
then the nick name of that user is returned,
else a new nick name unique for that e-mail is suggested
|
allcaps, allcaps, clear, clone, columns, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getIntArray, getInteger, getIntegerArray, getIntervalPart, getItemMap, getItems, getMoney, getPrimaryKey, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTime, getTimeOfDay, getTimestamp, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, setPrimaryKey, size, toLowerCase, toUpperCase, toXML, toXML, toXML, values
public static final short ClassId
public ACLUser()
public ACLUser(java.lang.String sUserGUID) throws java.sql.SQLException
Constructs ACLUser and set GUID
Does not load any fields from database.sUserGUID
- user Unique Identifier (gu_user field at k_users table)java.sql.SQLException
public ACLUser(JDCConnection oConn, java.lang.String sUserGUID) throws java.sql.SQLException
Constructs ACLUser and load attributes from k_users table
oConn
- Database ConnectionsUserGUID
- user Unique Identifier (gu_user field at k_users table)java.sql.SQLException
public java.lang.String getFullName()
public DBSubset getAddresses(JDCConnection oConn) throws java.sql.SQLException
Get Addresses associated with user at k_x_addr_user table.
oConn
- Database ConnectionDBSubset
with a 3 columns containing
Address Unique Identifier (gu_address), Address Ordinal Position (ix_address)
and Address Location Type (tp_location).java.sql.SQLException
Address}
public DBSubset getGroups(JDCConnection oConn) throws java.sql.SQLException
oConn
- Database ConnectionDBSubset
with a 1 column containing each group unique identifier (gu_acl_group).java.sql.SQLException
public int addToACLGroups(JDCConnection oConn, java.lang.String sGroupList) throws java.sql.SQLException
Add User to Groups.
Insert new registers at k_x_group_user table.
oConn
- Database ConnectionsGroupList
- A string of comma delimited ACLGroup GUIDs to with this ACLUser must be added.java.sql.SQLException
- May throw a primary key constraint violation if user already belongs to group.public boolean isDomainAdmin(JDCConnection oConn) throws java.sql.SQLException, java.lang.IllegalStateException
Find out is this user has administrator.
A user may have administrator priviledges in two ways:
1.- It can belong to the group gu_admins from k_domains table.
2.- Its user identifier may be the one at gu_owner field of k_domains table.
The domain owner is a special kind of administrator user that cannot be deleted from domain.
oConn
- Database Connectionjava.lang.IllegalStateException
- if id_domain or gu_user is not setjava.sql.SQLException
public boolean store(JDCConnection oConn) throws java.sql.SQLException
Store ACLUser
If gu_user is not set then a new GUID is assigned.public boolean delete(JDCConnection oConn) throws java.sql.SQLException
DBPersist
Delete a register from database
The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.
public int clearACLGroups(JDCConnection oConn) throws java.sql.SQLException
Remove user from all security role groups
oConn
- Database Connectionjava.sql.SQLException
public int removeFromACLGroup(JDCConnection oConn, java.lang.String sIdGroup) throws java.sql.SQLException
Remove User from Group.
remove register from k_x_group_user table.
oConn
- Database ConnectionsIdGroup
- Group Unique Identifier.java.sql.SQLException
public java.lang.String getMailRoot(JDCConnection oConn) throws java.sql.SQLException
Get GUID of user mail root category
The user mail root category is always named DOMAIN_nickname_mail at nm_category field of k_categories.oConn
- Database Connectionjava.sql.SQLException
public java.lang.String getMailFolder(JDCConnection oConn, java.lang.String sFolderName) throws java.sql.SQLException
Get GUID of user mail folder category
The Inbox category is where messages downloaded from the mail server are cached by default. The user mail inbox category is always named DOMAIN_nickname_inbox at nm_category field of k_categories.oConn
- Database ConnectionsFolderName
- One of { "inbox", "drafts", "deleted", "sent", "spam" }java.sql.SQLException
java.lang.NullPointerException
- if sFolderName is null or empty stringpublic java.lang.String[] getMailFolders(JDCConnection oConn) throws java.sql.SQLException
Get GUID of all user mail folders
java.sql.SQLException
public java.lang.String[] getMailFolderNames(JDCConnection oConn) throws java.sql.SQLException
Get name of all user mail folders
java.sql.SQLException
public int getRolesForApplication(JDCConnection oConn, int iIdApp, java.lang.String sGuWorkArea) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isAdminForApplication(JDCConnection oConn, int iIdApp, java.lang.String sGuWorkArea) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isPowerUserForApplication(JDCConnection oConn, int iIdApp, java.lang.String sGuWorkArea) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isUserForApplication(JDCConnection oConn, int iIdApp, java.lang.String sGuWorkArea) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isAdminForApplication(JDCConnection oConn, int iIdApp) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isPowerUserForApplication(JDCConnection oConn, int iIdApp) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isUserForApplication(JDCConnection oConn, int iIdApp) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean isGuestForApplication(JDCConnection oConn, int iIdApp) throws java.sql.SQLException
oConn
- JDCConnectioniIdApp
- int Id of application (from k_apps table)sGuWorkArea
- String Guid of WorkArea (from k_workareas table)java.sql.SQLException
public boolean checkChallengeReply(JDCConnection oConn, java.lang.String sReply)
public static java.lang.String getIdFromEmail(java.sql.Connection oConn, java.lang.String sUserEMail) throws java.sql.SQLException
Get User Unique Id. from its main e-mail address.
This method calls k_get_user_from_email stored procedure.
oConn
- Database ConnectionsUserEMail
- User main e-mail (tx_main_email from k_users table)java.sql.SQLException
public static java.lang.String getIdFromEmail(JDCConnection oConn, java.lang.String sUserEMail) throws java.sql.SQLException
Get User Unique Id. from its main e-mail address.
This method calls k_get_user_from_email stored procedure.
oConn
- Database ConnectionsUserEMail
- User main e-mail (tx_main_email from k_users table)java.sql.SQLException
public static java.lang.String getEmailFromId(JDCConnection oConn, java.lang.String sUserId) throws java.sql.SQLException
Get User main e-mail from its GUID.
oConn
- Database ConnectionsUserId
- User GUID (gu_user from k_users table)java.sql.SQLException
public static java.lang.String getIdFromNick(java.sql.Connection oConn, int iDomainId, java.lang.String sUserNick) throws java.sql.SQLException
Get User Unique Id. from its nickname.
This method executes a SQL query with a ResultSet
oConn
- Database ConnectioniDomainId
- Domain Numeric Id. (id_domain from k_users table)sUserNick
- User nickname (tx_nickname from k_users table)java.sql.SQLException
public static java.lang.String getIdFromNick(java.sql.Connection oConn, java.lang.String sUserNick) throws java.sql.SQLException
Get User Unique Id. from its nickname.
This method executes a SQL query with a ResultSet
oConn
- Database ConnectionsUserNick
- User nickname (tx_nickname from k_users table)java.sql.SQLException
- If more than one user is found with the same nickname at
different domains.public static java.lang.String getIdFromNick(JDCConnection oConn, int iDomainId, java.lang.String sUserNick) throws java.sql.SQLException
Get User Unique Id. from its nickname.
This method calls k_get_user_from_nick stored procedure.
oConn
- Database ConnectioniDomainId
- Domain Numeric Unique IdentifiersUserNick
- User nickname (tx_nickname from k_users table)java.sql.SQLException
public static boolean delete(JDCConnection oConn, java.lang.String sUserGUID) throws java.sql.SQLException, java.io.IOException
Delete User
Categories owned by this user are also deleted, but other data and references for user are not checked.
oConn
- Database ConnectionsUserGUID
- User Unique Identifierjava.sql.SQLException
java.io.IOException
public static java.lang.String create(JDCConnection oConn, java.lang.String sGuid, java.lang.Object[] Values) throws java.sql.SQLException, java.lang.ClassCastException, java.lang.NullPointerException
Shortcut for creating a new user with a given GUID
oConn
- Database ConnectionsGuid
- GUID of new userValues
- User fields, all required, must be in this order { (Integer)id_domain, (String)tx_nickname, (String)tx_pwd, (Short)bo_active, (Short)bo_searchable, (Short)bo_change_pwd, (String)tx_main_email, (String)tx_alt_email, (String)nm_user, (String)tx_surname1, (String)tx_surname2, (String)tx_challenge, (String)tx_reply, (String)nm_company, (String)de_title, (String)gu_workarea, (String)tx_comments, (Date)dt_pwd_expires }java.sql.SQLException
- If another user with the same GUID already existsjava.lang.ClassCastException
java.lang.NullPointerException
public static java.lang.String create(JDCConnection oConn, java.lang.Object[] Values) throws java.sql.SQLException, java.lang.ClassCastException, java.lang.NullPointerException
Shortcut for creating a new user
oConn
- Database ConnectionValues
- User fields, all required, must be in this order { (Integer)id_domain, (String)tx_nickname, (String)tx_pwd, (Short)bo_active, (Short)bo_searchable, (Short)bo_change_pwd, (String)tx_main_email, (String)tx_alt_email, (String)nm_user, (String)tx_surname1, (String)tx_surname2, (String)tx_challenge, (String)tx_reply, (String)nm_company, (String)de_title, (String)gu_workarea, (String)tx_comments, (Date)dt_pwd_expires }java.sql.SQLException
java.lang.ClassCastException
java.lang.NullPointerException
public static boolean resetPassword(JDCConnection oConn, java.lang.String sUserId, java.lang.String sNewPwd, java.util.Date dtExpire) throws java.sql.SQLException, java.lang.NullPointerException
oConn
- JDCConnectionsUserId
- String User GUIDsNewPwd
- String New password (up to 50 characters)dtExpire
- Date of expiration of new password or null if password never expiresSQLxception
java.lang.NullPointerException
java.sql.SQLException
public static boolean resetPassword(JDCConnection oConn, java.lang.String sUserId, java.lang.String sNewPwd) throws java.sql.SQLException, java.lang.NullPointerException
oConn
- JDCConnectionsUserId
- String User GUIDsNewPwd
- String New password (up to 50 characters)SQLxception
java.lang.NullPointerException
java.sql.SQLException
public static boolean resetPassword(JDCConnection oConn, java.lang.String sUserId, java.lang.String sNewPwd, DistributedCachePeer oCache) throws java.sql.SQLException, java.lang.NullPointerException, java.rmi.RemoteException
oConn
- JDCConnectionsUserId
- String User GUIDsNewPwd
- String New password (up to 50 characters)oCache
- DistributedCachePeerSQLxception
java.lang.NullPointerException
java.sql.SQLException
java.rmi.RemoteException
public static boolean resetPassword(JDCConnection oConn, java.lang.String sUserId, java.lang.String sNewPwd, java.util.Date dtExpire, DistributedCachePeer oCache) throws java.sql.SQLException, java.lang.NullPointerException, java.rmi.RemoteException
oConn
- JDCConnectionsUserId
- String User GUIDsNewPwd
- String New password (up to 50 characters)dtExpire
- Date of expiration of new password or null if password never expiresoCache
- DistributedCachePeerSQLxception
java.lang.NullPointerException
java.sql.SQLException
java.rmi.RemoteException
public static boolean checkSignature(JDCConnection oConn, java.lang.String sUserId, java.lang.String sSign) throws java.sql.SQLException, java.lang.NullPointerException
JDCConnection
- sUserId
- User GUIDsSign
- Signature Password to be checkedjava.sql.SQLException
- if no user with given GUID exists at the databasejava.lang.NullPointerException
- is sSign is nullpublic static boolean resetSignature(JDCConnection oConn, java.lang.String sUserId, java.lang.String sNewSign) throws java.sql.SQLException
JDCConnection
- sUserId
- User GUIDsNewSign
- New Signature Passwordjava.sql.SQLException
- if no user with given GUID exists at the databasejava.lang.NullPointerException
- is sSign is nullpublic static java.lang.String suggestNickForEmail(JDCConnection oConn, java.lang.String sEmail) throws java.sql.SQLException, java.lang.NullPointerException
Suggest a unique nick name for a given e-mail
If a user with given e-mail already exists at k_users table, then the nick name of that user is returned, else a new nick name unique for that e-mail is suggestedJDCConnection
- sEmail
- java.sql.SQLException
- if no user with given GUID exists at the databasejava.lang.NullPointerException
- is sEmail is null