|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.sconman.SecurityContext
public class SecurityContext
This class handles security elements, as users, roles, permissions, and does security checks
Constructor Summary | |
---|---|
SecurityContext(Project project)
Main constructor |
Method Summary | |
---|---|
(package private) Role |
addRole(java.lang.String roleName)
Adds a new role, given its id |
Role |
addRole(User user,
java.lang.String roleName)
Adds a new role, given its id |
(package private) User |
addUser(java.lang.String login,
java.lang.String password,
java.lang.String firstName,
java.lang.String lastName,
java.lang.String email)
Adds a new user |
User |
addUser(User user,
java.lang.String login,
java.lang.String password,
java.lang.String firstName,
java.lang.String lastName,
java.lang.String email)
Adds a new user to the system |
(package private) void |
check(User user,
Permission permission)
Checks a user permission |
boolean |
checkUserExists(java.lang.String login)
Returns true if there's a user for the specified login |
void |
deserializeXML(org.kxml2.io.KXmlParser in)
Deserialize from XML |
(package private) Permission |
getAddNewContentPermission(ContentType ctype)
Returns the permission create contents of the specified type. |
(package private) Permission |
getAddNewContentPermission(User actor,
ContentType ctype)
Returns the permission create contents of the specified type. |
(package private) Permission |
getAdminProjectPermission()
Returns the permission to admin the project. |
(package private) Permission |
getAdminProjectPermission(User actor)
Returns the permission to admin the project. |
(package private) Permission |
getAdminRolesPermission()
Returns the permission to admin roles. |
(package private) Permission |
getAdminRolesPermission(User actor)
Returns the permission to admin roles. |
(package private) Permission |
getAdminUsersPermission()
Returns the permission to admin users. |
(package private) Permission |
getAdminUsersPermission(User actor)
Returns the permission to admin users. |
(package private) Permission |
getAllPermissions()
Returns the permission to do everything |
(package private) Permission |
getDeleteContentPermission(ContentType ctype)
Returns the permission delete contents of the specified type. |
(package private) Permission |
getDeleteContentPermission(User actor,
ContentType ctype)
Returns the permission delete contents of the specified type. |
(package private) java.lang.String |
getDigested(boolean hexFormat,
java.lang.String str)
Hashes a String, useful for password hidding |
(package private) Permission |
getModifyCategoryPermission(Category cat)
Returns the permission to modify a category. |
(package private) Permission |
getModifyCategoryPermission(User actor,
Category cat)
Returns the permission to modify a category. |
(package private) Permission |
getModifyContentPermission(ContentType ctype)
Returns the permission modify contents of the specified type. |
(package private) Permission |
getModifyContentPermission(User actor,
ContentType ctype)
Returns the permission modify contents of the specified type. |
(package private) Permission |
getPermission(Category cat,
java.lang.String action)
Returns the permission associated to the action on the category |
(package private) Permission |
getPermission(java.lang.String name)
Returns a permission, known its id |
(package private) Permission |
getPermission(User user,
Category cat,
java.lang.String action)
Returns the permission associated to the action on the category |
(package private) Permission |
getPermission(User user,
ContentType ctype,
java.lang.String action)
Returns the permission associated to the action on the content type |
(package private) Project |
getProject()
Returns the parent project |
Role |
getRole(java.lang.String name)
Returns a role, known its id |
(package private) java.util.Map |
getRoles()
|
(package private) User |
getUser(java.lang.String login)
Returns a user known its login |
User |
getUser(User actor,
java.lang.String login)
Returns a user, known its login. |
(package private) Content |
getUserContent(java.lang.String login,
java.lang.String password)
|
(package private) Permission |
getViewCategoryPermission(Category cat)
Returns the permission to view a category. |
(package private) Permission |
getViewCategoryPermission(User actor,
Category cat)
Returns the permission to view a category. |
(package private) Permission |
getViewContentPermission(ContentType ctype)
Returns the permission view contents of the specified type. |
(package private) Permission |
getViewContentPermission(User actor,
ContentType ctype)
Returns the permission view contents of the specified type. |
User |
loginUser(java.lang.String login,
java.lang.String password)
Returns the user, known its login and password, or null if doesn't exists |
(package private) void |
removeRole(java.lang.String roleName)
Removes a role, given its id |
void |
removeRole(User user,
java.lang.String roleName)
Removes a role, given its id, including all the users who contains the Role |
java.util.List |
searchUsers(User actor,
java.lang.String login,
java.lang.String fname,
java.lang.String lname,
int max)
Returns the list of users that matches the criteria |
void |
serializeXML(org.kxml2.io.KXmlSerializer out)
Serialize to XML |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
SecurityContext(Project project)
project
- The owner projectMethod Detail |
---|
Project getProject()
Permission getPermission(java.lang.String name)
id
- The permission id
java.util.Map getRoles()
public Role getRole(java.lang.String name)
id
- The role id
Role addRole(java.lang.String roleName)
roleName
-
public Role addRole(User user, java.lang.String roleName) throws SCMSecurityException
user
- The user that adds the roleroleName
-
SCMSecurityException
void removeRole(java.lang.String roleName) throws SCMStorageException
roleName
-
SCMStorageException
public void removeRole(User user, java.lang.String roleName) throws SCMSecurityException, SCMStorageException
user
- The user that removes the roleroleName
-
SCMSecurityException
SCMStorageException
Content getUserContent(java.lang.String login, java.lang.String password) throws SCMStorageException
SCMStorageException
public User loginUser(java.lang.String login, java.lang.String password) throws SCMLoginException
login
- The user's loginpassword
- The user's password
SCMLoginException
User getUser(java.lang.String login) throws SCMStorageException
login
-
SCMStorageException
public User getUser(User actor, java.lang.String login) throws SCMStorageException, SCMSecurityException
actor
- The user that performs the action, that must have user
administration permissionslogin
-
SCMStorageException
SCMSecurityException
public java.util.List searchUsers(User actor, java.lang.String login, java.lang.String fname, java.lang.String lname, int max) throws SCMStorageException, SCMSecurityException
actor
- login
- fname
- lname
- beginIndex
- endIndex
-
SCMStorageException
SCMSecurityException
public boolean checkUserExists(java.lang.String login) throws SCMStorageException
login
-
SCMStorageException
User addUser(java.lang.String login, java.lang.String password, java.lang.String firstName, java.lang.String lastName, java.lang.String email) throws SCMStorageException
login
- password
- firstName
- lastName
- email
-
java.io.IOException
SCMStorageException
public User addUser(User user, java.lang.String login, java.lang.String password, java.lang.String firstName, java.lang.String lastName, java.lang.String email) throws SCMStorageException, SCMSecurityException
user
- login
- password
- firstName
- lastName
- email
-
SCMException
SCMStorageException
SCMSecurityException
Permission getPermission(User user, ContentType ctype, java.lang.String action) throws SCMSecurityException
ctype
- string
-
SCMSecurityException
Permission getPermission(Category cat, java.lang.String action)
cat
- The categoryaction
- The action
Permission getPermission(User user, Category cat, java.lang.String action) throws SCMSecurityException
cat
- The categoryaction
- The action
SCMSecurityException
Permission getAllPermissions()
Permission getAdminProjectPermission()
Permission getAdminProjectPermission(User actor) throws SCMSecurityException
actor
- The user that request the permission
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getAdminUsersPermission()
Permission getAdminUsersPermission(User actor) throws SCMSecurityException
actor
- The user that request the permission
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getAdminRolesPermission()
Permission getAdminRolesPermission(User actor) throws SCMSecurityException
actor
- The user that request the permission
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getViewCategoryPermission(Category cat)
cat
- The category to view
Permission getViewCategoryPermission(User actor, Category cat) throws SCMSecurityException
actor
- The user that request the permissioncat
- The category to view
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getModifyCategoryPermission(Category cat)
cat
- The category to modify
Permission getModifyCategoryPermission(User actor, Category cat) throws SCMSecurityException
actor
- The user that request the permissioncat
- The category to modify
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getAddNewContentPermission(ContentType ctype)
ctype
- The content type
Permission getAddNewContentPermission(User actor, ContentType ctype) throws SCMSecurityException
actor
- The user that request the permissionctype
- The content type
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getViewContentPermission(ContentType ctype)
ctype
- The content type
Permission getViewContentPermission(User actor, ContentType ctype) throws SCMSecurityException
actor
- The user that request the permissionctype
- The content type
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getModifyContentPermission(ContentType ctype)
ctype
- The content type
Permission getModifyContentPermission(User actor, ContentType ctype) throws SCMSecurityException
actor
- The user that request the permissionctype
- The content type
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionPermission getDeleteContentPermission(ContentType ctype)
ctype
- The content type
Permission getDeleteContentPermission(User actor, ContentType ctype) throws SCMSecurityException
actor
- The user that request the permissionctype
- The content type
SCMSecurityException
- Thrown when the actor doesn't have the admin project
permissionvoid check(User user, Permission permission) throws SCMSecurityException
user
- The user to check the permission againstpermission
- The permission to check
SCMSecurityException
- Throw when the user doesn't have the permissionjava.lang.String getDigested(boolean hexFormat, java.lang.String str)
str
-
public void serializeXML(org.kxml2.io.KXmlSerializer out) throws java.io.IOException
IXMLSerializable
serializeXML
in interface IXMLSerializable
out
- The KXmlSerializer to do the output
java.io.IOException
- Thrown if there's an IO problempublic void deserializeXML(org.kxml2.io.KXmlParser in) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
IXMLSerializable
deserializeXML
in interface IXMLSerializable
in
- The KXml pull parser
org.xmlpull.v1.XmlPullParserException
- Thrown if there's an XML problem
java.io.IOException
- Thrown if there's an IO problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |