|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Implemented by objects that manage the handling of SilverStream security expressions.
| Method Summary | |
String |
getExpressionFromUsersAndGroups(Enumeration users,
Enumeration groups)
Given a list of users and a list of groups, construct a security expression that corresponds to the lists. |
Enumeration |
getUsersAndGroupsFromExpression(AgiAdmElement element,
String expression)
Render the list of users and groups from the given security expression Return null if the expression is not a simple list of users and groups, otherwise return an enumeration of AgiAdmUser's and AgiAdmGroups. |
boolean |
verifySecurityExpression(AgiAdmElement element,
String expression)
Check whether the specified security expression is valid for the given element. |
| Method Detail |
public String getExpressionFromUsersAndGroups(Enumeration users,
Enumeration groups)
throws AgoUnrecoverableSystemException,
AgoSecurityException
users - an enumeration of AgiAdmUsersgroups - an enumeration of AgiAdmGroups
// Get an Expression Manager.
AgiAdmExpressionMgr exprMgr = AgAdmin.getExpressionMgrObject();
Vector users = new Vector();
Vector groups = new Vector();
// Create a list of users.
AgiAdmUser user1 = (AgiAdmUser)server.getElement("user1", AgiAdmUser.SILVERUSER, null);
AgiAdmUser user2 = (AgiAdmUser)server.getElement("user2", AgiAdmUser.SILVERUSER, null);
users.addElement(user1);
users.addElement(user2);
// Create a list of groups.
AgiAdmGroup group1 = (AgiAdmGroup)server.getElement("group1", AgiAdmGroup.SILVERGROUP, null);
AgiAdmGroup group2 = (AgiAdmGroup)server.getElement("group2", AgiAdmGroup.SILVERGROUP, null);
groups.addElement(group1);
groups.addElement(group2);
// Construct a SilverStream security expression from the two lists.
String expression = exprMgr.getExpressionFromUsersAndGroups(users.elements(), groups.elements());
AgiAdmUser,
AgiAdmGroup
public Enumeration getUsersAndGroupsFromExpression(AgiAdmElement element,
String expression)
throws AgoUnrecoverableSystemException,
AgoSecurityException
element - the element for which the expression is being renderedexpression - security expression
// Get an element for which we will attempt to render an expression.
Hashtable info = new Hashtable();
info.put(AgiAdmServer.INFO_DATABASE_NAME, "database");
AgiAdmDesignElement el = (AgiAdmDesignElement)server.getElement("myForm", AgiAdmDesignElement.FORM, info);
// Define an expression that is to be rendered.
String expression =
"userID() in (userID('administrator'),userID('BRILLIANT\\Administrator'))";
// Try to get the list of users and groups.
Enumeration e = exprMgr.getUsersAndGroupsFromExpression(
el, expression);
// Go through the list to look at the user and group information.
if (e == null)
{
System.out.println("Not a simple list.");
// ... any other code for handling this case
}
else
{
while(e.hasMoreElements())
{
AgiAdmElement el = (AgiAdmElement)e.nextElement();
if (el instanceof AgiAdmUser)
{
System.out.println("User " + el.getName());
// ... any other processing
}
else if (el instanceof AgiAdmGroup)
{
System.out.println("Group " + el.getName());
// ... any other processing
}
}
}
AgiAdmElement
public boolean verifySecurityExpression(AgiAdmElement element,
String expression)
throws AgoUnrecoverableSystemException,
AgoSecurityException
element - the element for which the expression is being checkedexpression - the expression
// Get an element for which the expression is to be verified.
Hashtable info = new Hashtable();
info.put(AgiAdmServer.INFO_DATABASE_NAME, "database");
AgiAdmDesignElement el = (AgiAdmDesignElement)server.getElement("myForm", AgiAdmDesignElement.FORM, info);
// Define an expression that is to be verified.
String expression =
"userID() in (userID('administrator'),userID('BRILLIANT\\Administrator'))";
// Verify the expression.
boolean isExprOK = exprMgr.verifySecurityExpression(
el, expression);
AgiAdmElement
|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||