public class UserSql extends AbstractSql
CREATE TABLE "user"
user | character varying(255) | not null
affil | character varying(255) |
pubkey | text |
email | character varying(255) |
farbe | character varying(255) |
notify | text |
passwd | character varying(255) |
Indexes:
"user_pkey" PRIMARY KEY, btree ("user")
Triggers:
_st1_logtrigger_8 AFTER INSERT OR DELETE OR UPDATE ON "user" FOR EACH ROW
EXECUTE PROCEDURE _st1.logtrigger('_st1', '8', 'kvvvvvv')
In this setup, the columns have the following meanings:
ProposalSql PI. It is given in the
target-xml as the User element.KEY_AFFILALLOWED, currently Core, AIP, IAC,
International, and Engineering. It can be overriden in the target-xml file as
the Institution element.MyColor.KEY_NOTIFYALLOWED, currently the values in the Notify
element in the target-xml file are supported. It can be overriden in the
target-xml file as the Institution element.| Modifier and Type | Class and Description |
|---|---|
static class |
UserSql.AddUser
Adds a new user with the command line.
|
static class |
UserSql.Circular
Mails to a number of stella users simultaneously.
|
static class |
UserSql.Recolor
Recalculates colors after too many users have been encountered.
|
static class |
UserSql.ResetPassword |
static class |
UserSql.RGB
Read all profiles and updates the farbe string.
|
private static class |
UserSql.SqlProfile
A user profile that is constructed from a database entry.
|
AbstractSql.Columns, AbstractSql.ExtractPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static EnumSet<DataPermission.Access> |
AFFILACCESS
The default action on affil-data.
|
private EnumSet<UserProfile.Affil> |
affilallow
The set of allowed affiliations.
|
private static String |
DEFAFFILALLOWED
The coma-separated list of allowed affiliations.
|
private static String |
DEFAFFILFIELD
The key to the object name in the database.
|
private static String |
DEFCOLORFIELD
The key to the object name in the database.
|
private static String |
DEFEMAILFIELD
The key to the object name in the database.
|
private static String |
DEFNOTIFYALLOWED
The coma-separated list of allowed notification triggers.
|
private static String |
DEFNOTIFYFIELD
The key to the object name in the database.
|
private static String |
DEFPASSWDFIELD
The key to the object name in the database.
|
private static String |
DEFPUBKEYFIELD
The key to the object name in the database.
|
private static String |
DEFTABLE
The default table name.
|
private static String |
DEFUSERFIELD
The key to the object name in the database.
|
static String |
KEY_AFFILALLOWED
The key to the allowed affiliations.
|
static String |
KEY_AFFILFIELD
The key to the object name in the database.
|
static String |
KEY_COLORFIELD
The key to the object name in the database.
|
static String |
KEY_EMAILFIELD
The key to the object name in the database.
|
static String |
KEY_NOTIFYALLOWED
The key to the allowed notify actions.
|
static String |
KEY_NOTIFYFIELD
The key to the object name in the database.
|
static String |
KEY_PASSWDFIELD
The key to the object name in the database.
|
static String |
KEY_PUBKEYFIELD
The key to the object name in the database.
|
static String |
KEY_USERFIELD
The key to the object name in the database.
|
private EnumSet<UserProfile.Notifies> |
notifyallow
The set of allowed notifications.
|
KEY_TABLE, SQLBATCHDIR, SQLFAILDIRKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
UserSql(Map<String,String> prop)
Constructs a new proposal sql.
|
| Modifier and Type | Method and Description |
|---|---|
PermissionCollection |
addUserPermissions(PermissionCollection permit,
String user)
Add to a
PermissionCollection the permissions for the user of the
given name. |
boolean |
addUserProfile(String username,
List<UserProfile.Affil> aa,
javax.mail.Address email,
Collection<UserProfile.Notifies> notify)
Adds a new user to the table.
|
boolean |
addUserProfile(String username,
List<UserProfile.Affil> aa,
javax.mail.Address email,
Collection<UserProfile.Notifies> notify,
boolean mail)
Adds a new user to the table.
|
boolean |
addUserProfile(String username,
List<UserProfile.Affil> affil,
javax.mail.Address email,
Collection<UserProfile.Notifies> notify,
Color paint,
boolean mail)
Adds a new user to the table.
|
private boolean |
addUserProfile(String username,
List<UserProfile.Affil> affil,
javax.mail.Address email,
Collection<UserProfile.Notifies> notify,
Color paint,
String asciipass,
boolean mail)
Adds a new user to the table.
|
private UserProfile |
fromNextRow(ResultSet single)
Returns the next user profile parsed from the result set.
|
private static UserProfile |
fromNextRow(ResultSet single,
String f1,
String f2,
String f3,
String f4,
String f5,
String f6,
String f7)
Returns the next user profile parsed from the result set.
|
static List<UserProfile> |
getAllUserProfiles()
Returns all user profiles found.
|
static List<UserProfile> |
getAllUserProfiles(String table)
Returns all user profiles found.
|
javax.mail.Address |
getEmail(String name) |
String |
getInsertText(Map<String,Object> uu) |
private int |
getMemberCount(UserProfile.Affil affil)
Returns the number of entries to the queried affiliation.
|
Color |
getNextAffilColor(UserProfile.Affil aa) |
String |
getPendingText(Map<String,Object> uu) |
private static String |
getSubject(String username) |
private static String |
getText(String username,
UserProfile.Affil affil,
Collection<UserProfile.Notifies> notify,
Color paint,
String asciipass) |
String |
getUpdateText(Map<String,Object> uu) |
UserProfile |
getUserProfile(String name)
Returns the user profile from the user name.
|
void |
init()
Convert the properties of allowed affiliations and notifications into
enum-sets.
|
private String |
resetPassword(String username)
For the stated user, auto-generate a password, MD5 encode and encrpyt it,
store the encrypted versions in the DB and return the plain password
(e.g., for sending e-mail to the user).
|
private UserProfile |
singleProfile(String where)
Convenience method returning just a single user profile.
|
boolean |
updatePassword(String username,
String md5,
String key)
For the stated user, update the password-relevant fields to the
respective values.
|
private List<UserProfile> |
userProfiles(String where) |
delete, distinct, distinct, exit, getAccess, getDefaultArchive, getDefaultFormat, getTable, insert, isEntry, release, release, replace, retrieve, retrieve, retrieve, single, singleclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String KEY_USERFIELD
public static final String KEY_AFFILFIELD
public static final String KEY_PUBKEYFIELD
public static final String KEY_EMAILFIELD
public static final String KEY_COLORFIELD
public static final String KEY_NOTIFYFIELD
public static final String KEY_PASSWDFIELD
public static final String KEY_AFFILALLOWED
public static final String KEY_NOTIFYALLOWED
private static final String DEFTABLE
private static final String DEFUSERFIELD
private static final String DEFAFFILFIELD
private static final String DEFPUBKEYFIELD
private static final String DEFEMAILFIELD
private static final String DEFCOLORFIELD
private static final String DEFNOTIFYFIELD
private static final String DEFPASSWDFIELD
private static final String DEFAFFILALLOWED
private static final String DEFNOTIFYALLOWED
private static final EnumSet<DataPermission.Access> AFFILACCESS
private EnumSet<UserProfile.Affil> affilallow
private EnumSet<UserProfile.Notifies> notifyallow
public void init()
throws InitException
init in interface Initializableinit in class AbstractSqlInitExceptionpublic PermissionCollection addUserPermissions(PermissionCollection permit, String user)
PermissionCollection the permissions for the user of the
given name. Uses a global permission on user's PI targets plus specific
permissions found in the permission table. Additionally adds the
group-specific affiliations.SecurityException - if the permission collection is read-only.public javax.mail.Address getEmail(String name) throws SQLException
SQLExceptionpublic UserProfile getUserProfile(String name)
private UserProfile singleProfile(String where)
where - private List<UserProfile> userProfiles(String where)
private UserProfile fromNextRow(ResultSet single) throws SQLException
SQLExceptionprivate static UserProfile fromNextRow(ResultSet single, String f1, String f2, String f3, String f4, String f5, String f6, String f7) throws SQLException
SQLExceptionpublic static List<UserProfile> getAllUserProfiles()
public static List<UserProfile> getAllUserProfiles(String table)
public boolean updatePassword(String username, String md5, String key) throws SQLException
username - The name of the user, not the e-mail.md5 - The md5-coded password (hex-string, lower case)key - The unix-MD5 encrypted password for /etc/shadowSQLExceptionprivate String resetPassword(String username) throws SQLException
username - The name of the user, not the e-mail.SQLExceptionpublic boolean addUserProfile(String username, List<UserProfile.Affil> aa, javax.mail.Address email, Collection<UserProfile.Notifies> notify)
IllegalArgumentException - If any of the input is not allowed. This applies to affil,
email and notify.public boolean addUserProfile(String username, List<UserProfile.Affil> aa, javax.mail.Address email, Collection<UserProfile.Notifies> notify, boolean mail)
IllegalArgumentException - If any of the input is not allowed. This applies to affil,
email and notify.public Color getNextAffilColor(UserProfile.Affil aa)
public boolean addUserProfile(String username, List<UserProfile.Affil> affil, javax.mail.Address email, Collection<UserProfile.Notifies> notify, Color paint, boolean mail)
IllegalArgumentException - If any of the input is not allowed. This applies to affil,
email and notify.private boolean addUserProfile(String username, List<UserProfile.Affil> affil, javax.mail.Address email, Collection<UserProfile.Notifies> notify, Color paint, String asciipass, boolean mail)
IllegalArgumentException - If any of the input is not allowed. This applies to affil,
email and notify.private static String getText(String username, UserProfile.Affil affil, Collection<UserProfile.Notifies> notify, Color paint, String asciipass)
private int getMemberCount(UserProfile.Affil affil)