|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--arlut.csd.ganymede.PermMatrix
Serializable permissions matrix object, used to handle permissions for a given user, admin, or role.
This class stores a read-only Hashtable of
PermEntry objects, organized by
object type and field id's.
The keys to the Hashtable are Strings that are encoded by the
static matrixEntry() methods defined in this class. I probably
could have used some sort of class object for the key, but then I
would have had to define a key() of similar complexity to the
matrixEntry() and decode methods anyway, as well as some sort of
on-disk representation for the Ganymede.db file.
Here's some examples of the key encoding algorithm:
3::/CODE> - Object type 3, permission for object itself3:10 - Object type 3, permission for field 10PermMatrix is used on the client in the Permissions Editor dialog,
and on the server in both
PermissionMatrixDBField
and GanymedeSession.
| Field Summary | |
(package private) static boolean |
debug
|
java.util.Hashtable |
matrix
|
(package private) static long |
serialVersionUID
|
| Constructor Summary | |
PermMatrix()
|
|
PermMatrix(java.util.Hashtable orig)
|
|
PermMatrix(PermMatrix orig)
|
|
| Method Summary | |
private java.lang.String |
baseEntry(java.lang.String matrixEntry)
Private helper method used to generate a matrixEntry() encoded String for a single DBObjectBase from
a matrixEntry() encoded String that also includes a field specification. |
private short |
entryBase(java.lang.String matrixEntry)
Private helper method used to decode a hash key generated by the matrixEntry() methods. |
private short |
entryField(java.lang.String matrixEntry)
Private helper method used to decode a hash key generated by the matrixEntry() methods. |
PermEntry |
getPerm(Base base)
Returns a PermEntry object representing this PermMatrix's permissions on the base <base> |
PermEntry |
getPerm(Base base,
BaseField field)
Returns a PermEntry object representing this PermMatrix's permissions on the field <field> in base <base> |
PermEntry |
getPerm(short baseID)
Returns a PermEntry object representing this PermMatrix's permissions on the base <baseID> |
PermEntry |
getPerm(short baseID,
short fieldID)
Returns a PermEntry object representing this PermMatrix's permissions on the field <fieldID> in base <baseID> |
private boolean |
isBasePerm(java.lang.String matrixEntry)
Returns true if the given String encodes the identity of a DBObjectBase and
not a field within a DBObjectBase. |
static void |
main(java.lang.String[] argv)
|
private java.lang.String |
matrixEntry(short baseID)
Private method to generate a key for use in our internal Hashtable, used to encode the permission for a given DBObjectBase. |
private java.lang.String |
matrixEntry(short baseID,
short fieldID)
Private method to generate a key for use in our internal Hashtable, used to encode the permission for a given DBObjectBase and DBObjectBaseField. |
java.lang.String |
toString()
Debugging output |
java.lang.String |
toString(boolean t)
|
PermMatrix |
union(java.util.Hashtable orig)
This method combines this PermMatrix with that of orig. |
PermMatrix |
union(PermMatrix orig)
This method combines this PermMatrix with that of orig. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final boolean debug
static final long serialVersionUID
public java.util.Hashtable matrix
| Constructor Detail |
public PermMatrix()
public PermMatrix(java.util.Hashtable orig)
public PermMatrix(PermMatrix orig)
| Method Detail |
public PermMatrix union(java.util.Hashtable orig)
This method combines this PermMatrix with that of orig. The returned PermMatrix will allow any access either of the source PermMatrices would.
public PermMatrix union(PermMatrix orig)
This method combines this PermMatrix with that of orig. The returned PermMatrix will allow any access either of the source PermMatrices would.
Note that unlike all the other methods in PermMatrix, we are handling inheritance of default permissions for an object base into fields which do not have permissions specified. We have to take this into account here in order to do a proper union.
As a consequence, this union() method is more complex than you might expect. That complexity really is needed.. don't mess with this unless you really, really know what you're doing.
public PermEntry getPerm(short baseID,
short fieldID)
Returns a PermEntry object representing this PermMatrix's permissions on the field <fieldID> in base <baseID>
If there is no entry in this PermMatrix for the given field, getPerm() will return null.
PermMatrixpublic PermEntry getPerm(short baseID)
Returns a PermEntry object representing this PermMatrix's permissions on the base <baseID>
PermMatrix
public PermEntry getPerm(Base base,
BaseField field)
Returns a PermEntry object representing this PermMatrix's permissions on the field <field> in base <base>
PermMatrixpublic PermEntry getPerm(Base base)
Returns a PermEntry object representing this PermMatrix's permissions on the base <base>
PermMatrix
private java.lang.String matrixEntry(short baseID,
short fieldID)
Private method to generate a key for use in
our internal Hashtable, used to encode the
permission for a given DBObjectBase and DBObjectBaseField.
private java.lang.String matrixEntry(short baseID)
Private method to generate a key for use in
our internal Hashtable, used to encode the
permission for a given DBObjectBase.
private boolean isBasePerm(java.lang.String matrixEntry)
Returns true if the given String encodes the identity of
a DBObjectBase and
not a field within a DBObjectBase.
private short entryBase(java.lang.String matrixEntry)
Private helper method used to decode a hash key generated by the matrixEntry() methods.
DBObjectBase
object id encoded by the given String.private short entryField(java.lang.String matrixEntry)
Private helper method used to decode a hash key generated by the matrixEntry() methods.
DBObjectBaseField
object id encoded by the given String.private java.lang.String baseEntry(java.lang.String matrixEntry)
Private helper method used to generate a matrixEntry() encoded String
for a single DBObjectBase from
a matrixEntry() encoded String that also includes a field specification.
public java.lang.String toString()
Debugging output
toString in class java.lang.Objectpublic java.lang.String toString(boolean t)
public static void main(java.lang.String[] argv)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||