|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sap.ip.me.api.security.Permission
Title: Permission
Description: List with permissions which shall be checked
Copyright: Copyright (c) 2003
Company: SAP
Example 1: checking for one single permission
User currentUser = getCurrentUser();
Permission userPerms = new Permission("TESTPERM", "DATA", "READ");
if(currentUser.hasPermission(userPerms)){
System.out.println("User has permission for " + userPerms.getName());
}
else {
System.out.println("User has NO permission for " + userPerms.getName());
}
If the user has a (backend) permission named 'TESTPERM' with the field 'DATA'
set to 'READ', this check returns true.
User currentUser = getCurrentUser();
Permission userPerms = new Permission("ARTICLES", "READ", "BEER");
userPerms.add("ARTICLES", "WRITE", "Lager");
userPerms.add("ARTICLES", "WRITE", "Budweiser");
if(currentUser.hasPermission(userPerms)){
System.out.println("User has permission for " + userPerms.getName());
}
else {
System.out.println("User has NO permission for " + userPerms.getName());
}
If the user has a (backend) permission named 'ARTICLES' with the field 'READ'
set to 'BEER' AND has a Permission named 'ARTICLES' with the field 'WRITE'
set to 'Lager' AND has a Permission named 'ARTICLES' with the field 'WRITE'
set to 'Budweiser' this check returns true, so he (maybe) is allowed to read all
beers and change Lager and Budweiser.
| Constructor Summary | |
Permission(java.lang.String name,
java.lang.String field,
java.lang.String action)
Constructor for the Permission object, adds the first PermissionEntry to its internal list |
|
| Method Summary | |
void |
add(java.lang.String name,
java.lang.String field,
java.lang.String action)
Adds a new PermissionEntry to the list of Permissions |
java.util.Vector |
get()
Returns a ArrayList with all PermissionEntries |
java.lang.String |
getName()
Gets the name of the Permission |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Permission(java.lang.String name,
java.lang.String field,
java.lang.String action)
name - name of the corresponding ABAP permissionobjectfield - fieldname of the corresponding ABAP permissionfieldaction - action value of the corresponding ABAP permissionvalue| Method Detail |
public void add(java.lang.String name,
java.lang.String field,
java.lang.String action)
name - name of the corresponding ABAP permissionobjectfield - fieldname of the corresponding ABA permissionfieldaction - action value of the corresponding ABAP permissionvaluepublic java.util.Vector get()
public java.lang.String getName()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||