|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.loco.perm.RoleManager
Maintains all database transactions dealing with roles.
Constructor Summary | |
RoleManager()
|
Method Summary | |
static void |
addRole(Role role,
java.sql.Connection conn)
Adds a new role to the database. |
static void |
addRoleToUser(int userId,
java.lang.String roleName,
java.sql.Connection conn)
Adds a role to a user. |
static boolean |
exists(java.lang.String roleName,
java.sql.Connection conn)
Verifies that a role exists in the DB. |
static int |
getNextId(java.sql.Connection conn)
Returns a unique id for a new role. |
static Role |
getRole(java.lang.String roleName,
java.sql.Connection conn)
Returns a role object from the database via its name. |
static java.util.Vector |
getRoleNames(java.sql.Connection conn)
Returns an enumeration of all the role names in the database. |
static java.util.Vector |
getRoleNamesForUser(int userId,
java.sql.Connection conn)
Lists all the role names associated with a user. |
static Role |
getRolesForUser(int userid,
java.sql.Connection conn)
Returns a role of all the user's roles OR'ed together. |
static void |
removeRole(java.lang.String roleName,
java.sql.Connection conn)
Removes an existing role from the database. |
static void |
removeRoleFromUser(int userId,
java.lang.String roleName,
java.sql.Connection conn)
Removes an existing role from a user. |
static void |
updateRole(Role role,
java.sql.Connection conn)
Updates an existing role in the database with new information (for instance, new permissions that get removed or added to a role). |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public RoleManager()
Method Detail |
public static int getNextId(java.sql.Connection conn) throws java.sql.SQLException
public static void addRole(Role role, java.sql.Connection conn) throws java.sql.SQLException
role
- role to be added to the databaseconn
- database connectionpublic static void removeRole(java.lang.String roleName, java.sql.Connection conn) throws java.sql.SQLException
roleName
- name of role to be removed from the databaseconn
- database connectionpublic static void updateRole(Role role, java.sql.Connection conn) throws java.sql.SQLException
role
- updated roleconn
- database connectionpublic static Role getRole(java.lang.String roleName, java.sql.Connection conn) throws java.sql.SQLException
roleName
- name of role being retrieved from the databaseconn
- database connectionRole
object (null
if role does not
exist)public static java.util.Vector getRoleNames(java.sql.Connection conn) throws java.sql.SQLException
conn
- database connectionpublic static boolean exists(java.lang.String roleName, java.sql.Connection conn) throws java.sql.SQLException
roleName
- name of role in questionconn
- database connectiontrue
if a role with this name existspublic static void addRoleToUser(int userId, java.lang.String roleName, java.sql.Connection conn) throws java.sql.SQLException
userId
- id of the userroleName
- name of the role being added to the userconn
- database connectionpublic static void removeRoleFromUser(int userId, java.lang.String roleName, java.sql.Connection conn) throws java.sql.SQLException
userId
- id of the userroleName
- name of the role being removed from the userconn
- database connectionpublic static java.util.Vector getRoleNamesForUser(int userId, java.sql.Connection conn) throws java.sql.SQLException
userId
- id of the userconn
- database connectionpublic static Role getRolesForUser(int userid, java.sql.Connection conn) throws java.sql.SQLException
userId
- id of the userconn
- database connection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |