public class SimplePrivilege extends AAAObjectBase implements Privilege
A simple and immutable Privilege implementation
Privilege.F| Modifier | Constructor and Description |
|---|---|
protected |
SimplePrivilege() |
|
SimplePrivilege(String name,
int level) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Privilege b)
Compare a privilege to another privilege.
|
int |
getLevel()
Returns the level of the privilege.
|
equals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertyclone, finalize, getClass, notify, notifyAll, wait, wait, waitequals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertyprotected SimplePrivilege()
public SimplePrivilege(String name, int level)
public int getLevel()
PrivilegeReturns the level of the privilege. Suppose a guarded object require a privilege_A to access. And a user has been granted with privilege_B. The logic of authorization is to compare the level of privilege_A to privilege_B. If privilege_A level is greater than that of privilege_B then the user has no access to the object been guarded. if privilege_A level is equals to or less then that of privilege_B, then the A has access to the object
public int compareTo(Privilege b)
PrivilegeCompare a privilege to another privilege. The result shall be align to compare the levels of the two privileges
compareTo in interface Comparable<Privilege>compareTo in interface Privilegeb - the privilege to be compared with this privilegeCopyright © 2017–2020 OSGL (Open Source General Library). All rights reserved.