|
Wildfire 3.1.1 Javadoc | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jivesoftware.wildfire.Permissions
public class Permissions
Represents a set of permissions that an entity has for an object in the system. For example, the rights that a user has for a category. Permissions are used by the protection proxy objects defined for each major component of the system to provide access rights.
A Permissions object is internally represented as a long with each bit indicating whether a particular permission is set. The constants defined by extensions of this class define the bit masks that can be used for permission operations. For example, the following code creates permissions:
// Create a permissions object with only read permissions set to true.
Permissions perms1 = new Permissions(ForumPermissions.READ_FORUM);
// Create a permissions object with read and system admin permissions set to true.
Permissions perms2 = new Permissions(ForumPermissions.READ_FORUM |
ForumPermissions.SYSTEM_ADMIN);
If we were to view the bits of each variable, perms1 would be
0000000000000000000000000000000000000000000000000000000000000001 and
perms2 would be
0000000000000000000000000000000010000000000000000000000000000001.
| Field Summary | |
|---|---|
static long |
GROUP_ADMIN
Permission to administer a particular group. |
static long |
NONE
No permissions. |
static long |
SYSTEM_ADMIN
Permission to administer the entire sytem. |
static long |
USER_ADMIN
Permission to administer a particular user. |
static long |
VIEW_ONLINE_STATUS
Permission to see the online status of a particular user. |
| Constructor Summary | |
|---|---|
Permissions(long permissions)
Create a new permissions object with the specified permissions. |
|
Permissions(Permissions permissions1,
Permissions permissions2)
Creates a new ForumPermission object by combining two permissions objects. |
|
| Method Summary | |
|---|---|
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
boolean |
hasPermission(long permissionTypes)
Returns true if one or more of the permission types is set to true. |
void |
set(long permissionTypes,
boolean value)
Sets the permissions given by a bit mask to true or false. |
String |
toString()
|
long |
value()
Returns the long value (bitmask) of the permissions that are set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long NONE
public static final long VIEW_ONLINE_STATUS
public static final long USER_ADMIN
public static final long GROUP_ADMIN
public static final long SYSTEM_ADMIN
| Constructor Detail |
|---|
public Permissions(long permissions)
permissions - integer bitmask values to for the new Permissions.
public Permissions(Permissions permissions1,
Permissions permissions2)
permissions1 - the first permissions to use when creating the new Permissions.permissions2 - the second permissions to use when creating the new Permissions.| Method Detail |
|---|
public boolean hasPermission(long permissionTypes)
permissionTypes -
public void set(long permissionTypes,
boolean value)
permissions.set(ForumPermissions.READ_FORUM | ForumPermissions.SYSTEM_ADMIN, true);
permissionTypes - the permission types to set.value - true to enable the permission, false to disable.public long value()
public String toString()
toString in class Objectpublic int getCachedSize()
Cacheable
getCachedSize in interface Cacheable
|
Wildfire 3.1.1 Javadoc | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||