|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
defines permission checking and setting for a base set of operations on objects.
the model resembles Unix file system permissions of read, write and execute, but those semantics are up to the application to decide
Also, like Unix, the concepts of users, groups, and a "superuser" are used.
| Field Summary | |
static java.lang.String |
ADMINISTRATOR
|
static java.lang.String |
PERMISSION_EXECUTE
Execute permission |
static java.lang.String |
PERMISSION_READ
Read permission |
static java.lang.String |
PERMISSION_WRITE
Write permission |
| Method Summary | |
Group |
addGroup(java.lang.String groupName,
int callerId)
Add a new Group to the database. |
User |
addUser(java.lang.String userName,
java.lang.String password,
int callerId)
Add a new user to the database. |
boolean |
addUserToGroup(User user,
Group group,
int callerId,
boolean isPrimary)
Add an existing user to a group. |
boolean |
checkExecute(int userId,
PermissionSet mask)
check if a user has a "execute" permission. |
boolean |
checkExecute(User user,
PermissionSet mask)
check if a user has an "execute" permission. |
boolean |
checkPermission(int userId,
PermissionSet mask,
java.lang.String perm)
check if a user has a certain permission. |
boolean |
checkPermission(User user,
PermissionSet mask,
java.lang.String perm)
check if a user has a certain permission. |
boolean |
checkRead(int userId,
PermissionSet mask)
check if a user has a "read" permission. |
boolean |
checkRead(User user,
PermissionSet mask)
check if a user has a "read" permission. |
boolean |
checkWrite(int userId,
PermissionSet mask)
check if a user has a "write" permission. |
boolean |
checkWrite(User user,
PermissionSet mask)
check if a user has a "write" permission. |
boolean |
deleteGroup(Group group,
int callerId)
Delete a group from the database. |
boolean |
deleteUser(User user,
int callerId)
Delete a user's entry from the database. |
boolean |
deleteUserFromGroup(User user,
Group group,
int callerId)
deleting the relationship between an existing user and a group. |
User |
getAdminUser()
|
Group |
getGroup(int id)
|
Group |
getGroup(java.lang.String name)
|
User |
getGuestUser()
|
User |
getUser(int id)
|
User |
getUser(java.lang.String name)
|
boolean |
isAdministrativeUser(int userId)
Check if a given user is an Administrator |
User |
login(java.lang.String hash)
authenticate using a hash code. |
User |
login(java.lang.String userName,
java.lang.String password)
authenticate the username and password. |
void |
setDefault(PermissionSet mask)
set the default granted permission. |
void |
setGroupExecute(PermissionSet mask,
boolean bit)
set a Group "Execute" permission |
void |
setGroupRead(PermissionSet mask,
boolean bit)
set a Group "Read" permission |
void |
setGroupWrite(PermissionSet mask,
boolean bit)
set a Group "Write" permission |
void |
setOwnerExecute(PermissionSet mask,
boolean bit)
set a Owner "Execute" permission |
void |
setOwnerRead(PermissionSet mask,
boolean bit)
set a Owner "Read" permission |
void |
setOwnerWrite(PermissionSet mask,
boolean bit)
set a Owner "Write" permission |
boolean |
setPrimaryGroup(User user,
Group group,
int callerId)
set the primary group of a user. |
void |
setWorldExecute(PermissionSet mask,
boolean bit)
set a World "Execute" permission |
void |
setWorldRead(PermissionSet mask,
boolean bit)
set a World "Read" permission |
void |
setWorldWrite(PermissionSet mask,
boolean bit)
set a World "Write" permission |
boolean |
updateGroup(Group group,
int callerId)
Update a Group's information in the database. |
boolean |
updateUser(User user,
int callerId)
Update a user's information. |
| Field Detail |
public static final java.lang.String PERMISSION_READ
public static final java.lang.String PERMISSION_WRITE
public static final java.lang.String PERMISSION_EXECUTE
public static final java.lang.String ADMINISTRATOR
| Method Detail |
public User login(java.lang.String userName,
java.lang.String password)
throws SecurityServiceException
userName - usernamepassword - password
null if unable to authenticate.
SecurityServiceException
public User login(java.lang.String hash)
throws SecurityServiceException
hash - the hash code
null if unable to authenticate.
SecurityServiceExceptionpublic boolean isAdministrativeUser(int userId)
userId - the ID of the User
true if the user is an Administrator,
false if the user is not an Administrator
public boolean checkPermission(User user,
PermissionSet mask,
java.lang.String perm)
user - a User object whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.perm - a String indicating the permission to be checked.
The valid value (case insensitive) are "read", "write", "execute".
true if the perm is granted
to the user,
false if the perm is not granted to
the user.
public boolean checkPermission(int userId,
PermissionSet mask,
java.lang.String perm)
userId - the ID of the user whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.perm - a String indicating the permission to be checked.
The valid value (case insensitive) are "read",
"write", "execute".
true if the perm is granted to
the userId,
false if the perm is not granted to
the userId.
public boolean checkRead(User user,
PermissionSet mask)
user - the user whose permission needs to be checked.mask - a PermissionSet object containing all the
granted permission information to be checked against.
true if the "read" permission is granted to
the userId,
false if the "read" permission is not granted
to the userId.
public boolean checkWrite(User user,
PermissionSet mask)
user - the user whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.
true if the "write" permission is granted
to the userId,
false if the "write" permission is not granted
to the userId.
public boolean checkExecute(User user,
PermissionSet mask)
user - the user whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.
true if the "execute" permission is
granted to the userId,
false if the read "permission" is not granted
to the userId.
public boolean checkRead(int userId,
PermissionSet mask)
userId - the id of the User object whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.
true if the "read" permission is
granted to the user,
false if the "read" permission is not granted to
the user.
public boolean checkWrite(int userId,
PermissionSet mask)
userId - the of the User object whose permission needs to be checked.mask - a PermissionSet object containing all the
granted permission information to be checked against.
true if the "write" permission is granted
to the user,
false if the "write" permission is not
granted to the user.
public boolean checkExecute(int userId,
PermissionSet mask)
userId - the id of the User object whose permission needs to be checked.mask - a PermissionSet object containing all the granted
permission information to be checked against.
true if the "execute" permission is
granted to the user,
false if the "execute" permission is not granted
to the user.public void setDefault(PermissionSet mask)
mask - the PermissionSet object to be set to default values.
public void setOwnerRead(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
Owner "Read" permission
public void setOwnerWrite(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with Owner
"Write" permission
public void setOwnerExecute(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
Owner "Execute" permission
public void setGroupRead(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
Group "Read" permission
public void setGroupWrite(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
Group "Write" permission
public void setGroupExecute(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
Group "Execute" permission
public void setWorldRead(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
World "Read" permission
public void setWorldWrite(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
World "Write" permission
public void setWorldExecute(PermissionSet mask,
boolean bit)
mask - the PermissionSet object to be set with
World "Execute" permission
public User addUser(java.lang.String userName,
java.lang.String password,
int callerId)
throws SecurityServiceException
userName - the new User name to be added to the database.password - the new password of the user to be added.callerId - the userId for the user who calls this method.
User object if the user is
added successfully,
null if permission is denied or addition is unsuccessful.
SecurityServiceException
public boolean updateUser(User user,
int callerId)
throws SecurityServiceException
user - the User object containing the new user
information to be updated in the database.callerId - the userId for the user who calls this method.
true if the user is
updated successfully,
false if permission is denied or update is unsuccessful.
SecurityServiceException
public boolean deleteUser(User user,
int callerId)
throws SecurityServiceException
user - the new User object to be deleted from the database.callerId - the userId for the user who calls this method.
true if the user is
deleted successfully,
false if permission is denied or deletion is unsuccessful.
SecurityServiceException
public Group addGroup(java.lang.String groupName,
int callerId)
throws SecurityServiceException
groupName - The new Group name to be added.callerId - the userId of the user who calls this method.
Group object if the
group is added successfully,
null if permission is denied or addition is unsuccessful.
SecurityServiceException
public boolean updateGroup(Group group,
int callerId)
throws SecurityServiceException
group - The Group object containing the updated information.callerId - the userId of the user who calls this method.
true if the group
is updated successfully,
false if permission is denied or update is unsuccessful.
SecurityServiceException
public boolean deleteGroup(Group group,
int callerId)
throws SecurityServiceException
group - The Group object to be deleted from the database.callerId - the userId of the user who calls this method.
true if the group is
deleted successfully,
false if permission is denied or deletion is unsuccessful.
SecurityServiceException
public boolean addUserToGroup(User user,
Group group,
int callerId,
boolean isPrimary)
throws SecurityServiceException
user - the User object to be added to a groupgroup - the groupisPrimary - indicating whether this group is going
to be the primary group for this user
a user may only have one primary group
true if the addition is successful,
false if permission is denied, or addition is unsuccessful
SecurityServiceException
public boolean deleteUserFromGroup(User user,
Group group,
int callerId)
throws SecurityServiceException
user - the User object to be removed to a groupgroup - the group
true if the deletion is successful,
false if permission is denied, or deletion is unsuccessful
SecurityServiceException
public boolean setPrimaryGroup(User user,
Group group,
int callerId)
throws SecurityServiceException
user - The User object for which a primary group is to be setgroup - The Group object which will be assigned as
the primary group for the usercallerId - the ID of the user who calls this method
true if the primary group is set successfully,
false if the permission is denied or
the group setting is unsuccessful.
SecurityServiceException
public User getUser(int id)
throws SecurityServiceException
id - the user Id
null if does not exist or error occurs.
SecurityServiceException
public User getUser(java.lang.String name)
throws SecurityServiceException
name - the user name
null if does not exist or error occurs.
SecurityServiceException
public User getGuestUser()
throws SecurityServiceException
null if does not exist or error occurs.
SecurityServiceException
public User getAdminUser()
throws SecurityServiceException
null if does not exist or error occurs.
SecurityServiceException
public Group getGroup(int id)
throws SecurityServiceException
id - the group id
null if does not exist or error occurs.
SecurityServiceException
public Group getGroup(java.lang.String name)
throws SecurityServiceException
name - the group's name
null if does not exist or error occurs.
SecurityServiceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||