|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.dataobjects.BaseDataObject
com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
com.jcorporate.expresso.core.dbobj.DBObject
com.jcorporate.expresso.core.dbobj.SecuredDBObject
com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
subclass this for support of row-level Authorization.
Typically, you construct RowSecuredDBObject passing in userId or the
controller request to set the requesting identity. Or, after construction, call
setRequestingUid() so that user of this DBObject is known. Otherwise,
security checks will always return false (and access methods will throw
SecurityException).
LIMITATION: the primary key for a given row is persisted, along with the
name of the table, to identify the permissions for that row. In other
words, the primary key for permissions is the row's table name plus the
row's primary key: permissionPK = targetTable + targetPrimKey.
Each database vendor (MySQL,
Oracle, etc.) has its own limit for the longest field that can be indexed
as a primary key. If a target row has a very long primary key, the database may
not be able to accommodate the primary key for its permissions. In that
case, a runtime exception is thrown when trying to persist the permissions.
If (length(permissionPK) > MAXIMUM for database) { throw runtime exception}
In most cases, the primary key is an integer or some other short field, so
this limitation is not a problem.
RowPermissions,
RowGroupPerms,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
DBObject.FieldError, DBObject.FieldUpdate |
| Field Summary |
| Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT, SYSTEM_ACCOUNT_NAME, UPDATE |
| Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject |
ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, UPDATE_CHANGED_ONLY, WHERE_KEYWORD |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject |
anyFieldsDistinct, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys |
| Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
currentStatus, globalMask |
| Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject |
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED |
| Constructor Summary | |
RowSecuredDBObject()
Constructor without parameters. |
|
RowSecuredDBObject(DBConnection theConnection,
int theUser)
Constructor: Specify a DB connection AND user id. |
|
RowSecuredDBObject(int theUser)
Creates a new RowSecuredDBObject object. |
|
RowSecuredDBObject(RequestContext request)
Creates a new RowSecuredDBObject object. |
|
| Method Summary | |
void |
add()
we override not to check permissions (which is done at the table level by superclass) but rather to add default permissions |
void |
add(String group,
int permissions)
|
void |
addGroupPerm(String group,
int perm)
add permissions for a group; will only ADD permissions, not replace will add row or update existing row (logical OR of bits) as necessary |
boolean |
canRequesterAdministrate()
|
boolean |
canRequesterRead()
determine if getRequestingUid has rights to read this row |
boolean |
canRequesterWrite()
|
protected void |
checkDeleteDetailPerm(DBObject obj)
check delete privilege for all detail records; different than superclass because we must set uid |
protected void |
checkKeyLength()
// warn if key of this row may be too long |
String |
defaultGroup()
|
int |
defaultPermissions()
override this to change default |
void |
delete(boolean deleteDetails)
delete row. always delete permission records too |
void |
deleteAll()
check that all objects can be deleted; must retrieve all objects to check individually |
boolean |
find()
find object on criteria provided in fields |
List |
getAdministrateGroups()
|
List |
getGroups()
find any existing permission groups for this object. |
RowPermissions |
getPermissions()
finds row permissions for the target row of this DBObject. if no row permissions are already persisted, the returned permissions object will be constructed and keyed to generating object, but all permissions will be false |
List |
getReadGroups()
|
List |
getWriteGroups()
|
boolean |
isRowAllowed(String requestedFunction)
determine if this function is allowed for this requesting user |
boolean |
isRowAllowed(String requestedFunction,
Collection items)
iterate through collection, testing each row's privileges remove any row which does not have privileges; (do not throw security exception, just remove row) |
int |
ownerID()
|
void |
removeGroup(String group)
remove a permissions group |
void |
retrieve()
retrieve object on criteria provided in fields |
ArrayList |
searchAndRetrieveList()
search on criteria provided in fields, and after search phase iterate through collection, testing each row's privileges remove any row which does not have privileges; (do not throw security exception, just remove row) |
ArrayList |
searchAndRetrieveList(String sortKeys)
search on criteria provided in fields, and after search phase iterate through collection, testing each row's privileges remove any row which does not have privileges; (do not throw security exception, just remove row) sort results by sortKeys |
void |
setPermissions(int perm)
set the permissions for this object; group bits are ignored; only owner & "other" permissions apply with this method owner id is taken from getRequestingUid() |
void |
setPermissions(String group,
int perm)
set the group and permissions for this object; owner id is taken from getRequestingUid() before permissions can be set, caller's permission to change permissions is tested |
void |
update()
before allowing update, check permission |
| Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject |
canRequesterAdd, canRequesterDelete, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, delete, getRequestingUid, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, search, setRequestingUid |
| Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject |
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RowSecuredDBObject()
throws DBException
DBException - upon database communication error
public RowSecuredDBObject(DBConnection theConnection,
int theUser)
throws DBException
theConnection - A DBConnection that this object should use to
connect to the databasetheUser - User name attempting to use this object. If this is
"SYSTEM", then full permissions are granted. Note that you
cannot log in as "SYSTEM", it can only be used from within a
method.
DBException - If the object cannot be created
public RowSecuredDBObject(int theUser)
throws DBException
theUser - requesting user
DBException - upon database communication error
public RowSecuredDBObject(RequestContext request)
throws DBException
request - context for using this object
DBException - upon database communication error| Method Detail |
public List getAdministrateGroups()
throws DBException
DBException - upon database communication error
public List getGroups()
throws DBException
DBException - upon database communication error
public void setPermissions(String group,
int perm)
throws DBException
group - name of groupperm - value of permissions
DBException - upon database communication error
public void setPermissions(int perm)
throws DBException
perm - permissions to set
DBException - upon database communication error
public RowPermissions getPermissions()
throws DBException
DBException - if keys are not set on this object
public List getReadGroups()
throws DBException
DBException - upon database communication error
public boolean isRowAllowed(String requestedFunction)
throws DBException
requestedFunction - code for function -- Add, Update, Delete, Search (read)
SecurityException - (unchecked) if not allowed
DBException - for other data-related errors.
public boolean isRowAllowed(String requestedFunction,
Collection items)
throws DBException
requestedFunction - code for function -- Add, Update, Delete, Search (read)items - is a collection of RowSecuredDBObjects
DBException - upon database communication error
public List getWriteGroups()
throws DBException
DBException - upon database communication error
public void add()
throws DBException
add in interface DataObjectadd in class SecuredDBObjectDBException - upon database communication errorfor a way to add() with more
specific permissions
public void add(String group,
int permissions)
throws DBException
DBException
public void addGroupPerm(String group,
int perm)
throws DBException
group - to be addedperm - to be added
DBException - upon database communication error
public boolean canRequesterAdministrate()
throws DBException
DBException - upon database communication error
public boolean canRequesterRead()
throws DBException
canRequesterRead in class SecuredDBObjectDBException - upon database communication error
public boolean canRequesterWrite()
throws DBException
DBException - upon database communication error
public String defaultGroup()
throws DBException
DBException - upon database communication errorpublic int defaultPermissions()
public void delete(boolean deleteDetails)
throws DBException
delete in class DBObjectdeleteDetails - set to true if related details should be deleted also
DBException - upon database communication errorto delete objects identified by non-key fields
public void deleteAll()
throws DBException
deleteAll in class SecuredDBObjectDBException - upon database communication error
public boolean find()
throws DBException
find in interface DataObjectfind in class SecuredDBObjectDBException - if user does not have rights to read found item
public int ownerID()
throws DBException
DBException - upon database communication error
public void removeGroup(String group)
throws DBException
group - to be removed
DBException - upon database communication error
public void retrieve()
throws DBException
retrieve in class SecuredDBObjectDBException - upon database communication error
public ArrayList searchAndRetrieveList()
throws DBException
searchAndRetrieveList in interface DataObjectsearchAndRetrieveList in class SecuredDBObjectDBException - upon database communication error
public ArrayList searchAndRetrieveList(String sortKeys)
throws DBException
searchAndRetrieveList in interface DataObjectsearchAndRetrieveList in class SecuredDBObjectsortKeys - sort field(s)
DBException - upon database communication error
public void update()
throws DBException
update in interface DataObjectupdate in class SecuredDBObjectDBException - upon database communication error
protected void checkDeleteDetailPerm(DBObject obj)
throws DBException
checkDeleteDetailPerm in class DBObjectobj - Object to be checked for deletion of detail records
DBException - upon database communication error
protected void checkKeyLength()
throws DBException
DBException - upon error
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||