|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.core.BasicItem<RoleData>
org.proteios.core.Role
public class Role
This class is used to represent roles. A role is used in the permission
system to give users access to various parts of Proteios. A permission given
to a role is global, ie. it applies to all items of a spcific type on the
entire server, and not only within a group or project. For example it is
possible to give READ access to all SAMPLE:s,
no matter if the owner has shared them to other users or not.
Proteios comes with a predefined set of roles, for example
ADMINISTRATOR and GUEST, which have been configured with
what we think is an appropriate combination of privileges. If you wish, you
may create more roles. Use roles only for functional grouping of the users,
and not for organisational grouping. If you wish to do that you should use a
Group or Project instead.
Group,
Project,
Default
permissions| Field Summary | |
|---|---|
static String |
ADMINISTRATOR
The id for the Role item representing adminstrators. |
static String |
GUEST
The id for the Role item representing guests. |
static String |
POWER_USER
The id for the Role item representing power users. |
static String |
SUPERVISOR
The id for the Role item representing supervisors. |
static Item |
TYPE
The type of item represented by this class. |
static String |
USER
The id for the Role item representing regular users. |
| Fields inherited from interface org.proteios.core.Nameable |
|---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
| Method Summary | |
|---|---|
void |
addUser(User user)
Assign this Role to a user. |
static Role |
getById(DbControl dc,
int id)
Get a Role item when you know the ID. |
String |
getDescription()
Get the description for the item. |
String |
getName()
Get the name of the item. |
static ItemQuery<Role> |
getQuery()
Get a ItemQuery object configured to retrieve Role
items. |
String |
getSystemId()
Get the system id for the item. |
Item |
getType()
Get the type of item represented by the object. |
ItemQuery<User> |
getUsers()
Get a query that returns the users that are members of this role. |
boolean |
isMember(User user)
Check if the given user is member of this role or not. |
boolean |
isRemoved()
Check if the removed flag is set for this item. |
boolean |
isSystemItem()
Check if the item is a system item or not. |
boolean |
isUsed()
Always return FALSE. |
void |
removeUser(User user)
Revoke this Role from a user. |
void |
setDescription(String description)
Set the description for the item. |
void |
setName(String name)
Set the name of the item. |
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
| Methods inherited from class org.proteios.core.BasicItem |
|---|
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.proteios.core.Identifiable |
|---|
getId, getVersion |
| Methods inherited from interface org.proteios.core.AccessControlled |
|---|
checkPermission, hasPermission |
| Field Detail |
|---|
public static final Item TYPE
Item.ROLE,
getType()public static final String ADMINISTRATOR
Role item representing adminstrators. By
default administrators have full privileges on the server.
public static final String SUPERVISOR
Role item representing supervisors. A
supervisor have READ permission to everything in Proteios.
public static final String POWER_USER
Role item representing power users. A power
user have less permissions than an administrator but may do some things
that an ordinary user may not.
public static final String USER
Role item representing regular users. This
role should be sufficient for most regular users of Proteios.
public static final String GUEST
Role item representing guests. Guests have
very limited access to the server.
| Method Detail |
|---|
public static Role getById(DbControl dc,
int id)
throws ItemNotFoundException,
PermissionDeniedException,
BaseException
Role item when you know the ID.
dc - The DbControl which will be used for permission
checking and database access.id - The ID of the item to load
Role item
ItemNotFoundException - If an item with the specified ID is not
found
PermissionDeniedException - If the logged in user doesn't have
Permission.READ permission to the item
BaseException - If there is another errorpublic static ItemQuery<Role> getQuery()
ItemQuery object configured to retrieve Role
items. If the logged in user doesn't have generic permission to all
roles, only roles where that user is a member are included in the list.
ItemQuery objectpublic Item getType()
IdentifiableItem enumeration.
getType in interface Identifiablepublic String getName()
Nameable
getName in interface NameableString with the name of the item
public void setName(String name)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_NAME_LENGTH constant.
setName in interface Nameablename - The new name for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH constantpublic String getDescription()
Nameable
getDescription in interface NameableString with a description of the item
public void setDescription(String description)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_DESCRIPTION_LENGTH constant.
setDescription in interface Nameabledescription - The new description for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH constantpublic boolean isRemoved()
Removable
isRemoved in interface Removable
public void setRemoved(boolean removed)
throws PermissionDeniedException
Removable
setRemoved in interface Removableremoved - TRUE if the item should be flagged as removed,
FALSE otherwise
PermissionDeniedException - If the logged in user doesn't
have Permission.DELETE permission for setting the flag
to TRUE or Permission.WRITE permission for setting the
flag to FALSEpublic String getSystemId()
SystemItem
getSystemId in interface SystemItempublic boolean isSystemItem()
SystemItem
isSystemItem in interface SystemItem
public boolean isUsed()
throws BaseException
isUsed in class BasicItem<RoleData>BaseException
public void addUser(User user)
throws PermissionDeniedException,
InvalidDataException
Role to a user.
user - The user to be assigned this role
PermissionDeniedException - If the logged in user doesn't have
Permission.WRITE permission for the role and
Permission.USE permission for the user
InvalidDataException - If the user is null
public void removeUser(User user)
throws PermissionDeniedException,
InvalidDataException
Role from a user.
user - The user that should be removed from this role
PermissionDeniedException - If the logged in user doesn't have
Permission.WRITE permission for the role and
Permission.USE permission for the user
InvalidDataException - If the user is nullpublic boolean isMember(User user)
user - The user to check
public ItemQuery<User> getUsers()
User.getQuery()
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||