diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java')
-rw-r--r-- | pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java b/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java index 208361286..31d15eb54 100644 --- a/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java +++ b/pki/base/common/src/com/netscape/certsrv/acls/ACLEntry.java @@ -17,15 +17,14 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.acls; - import java.util.Enumeration; import java.util.Hashtable; import java.util.StringTokenizer; - /** * A class represents an ACI entry of an access control list. * <P> + * * @version $Revision$, $Date$ */ public class ACLEntry implements IACLEntry, java.io.Serializable { @@ -47,8 +46,9 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Checks if this ACL entry is set to negative. - * @return true if this ACL entry expression is for "deny"; - * false if this ACL entry expression is for "allow" + * + * @return true if this ACL entry expression is for "deny"; false if this + * ACL entry expression is for "allow" */ public boolean isNegative() { return mNegative; @@ -63,8 +63,10 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Sets the ACL entry string + * * @param s string in the following format: - * <PRE> + * + * <PRE> * allow|deny (right[,right...]) attribute_expression * </PRE> */ @@ -72,10 +74,12 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { mACLEntryString = s; } - /** + /** * Gets the ACL Entry String + * * @return ACL Entry string in the following format: - * <PRE> + * + * <PRE> * allow|deny (right[,right...]) attribute_expression * </PRE> */ @@ -84,11 +88,12 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { } /** - * Adds permission to this entry. Permission must be one of the - * "rights" defined for each protected resource in its ACL + * Adds permission to this entry. Permission must be one of the "rights" + * defined for each protected resource in its ACL + * * @param acl the acl instance that this aclEntry is associated with - * @param permission one of the "rights" defined for each - * protected resource in its ACL + * @param permission one of the "rights" defined for each protected resource + * in its ACL */ public void addPermission(IACL acl, String permission) { if (acl.checkRight(permission) == true) { @@ -99,8 +104,8 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { } /** - * Returns a list of permissions associated with - * this entry. + * Returns a list of permissions associated with this entry. + * * @return a list of permissions for this ACL entry */ public Enumeration permissions() { @@ -109,8 +114,9 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Sets the expression associated with this entry. + * * @param expressions the evaluator expressions. For example, - * group="Administrators" + * group="Administrators" */ public void setAttributeExpressions(String expressions) { mExpressions = expressions; @@ -118,20 +124,21 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Retrieves the expression associated with this entry. - * @return the evaluator expressions. For example, - * group="Administrators" + * + * @return the evaluator expressions. For example, group="Administrators" */ public String getAttributeExpressions() { return mExpressions; } /** - * Checks to see if this <code>ACLEntry</code> contains a - * particular permission - * @param permission one of the "rights" defined for each - * protected resource in its ACL - * @return true if permission contained in the permission list - * for this <code>ACLEntry</code>; false otherwise. + * Checks to see if this <code>ACLEntry</code> contains a particular + * permission + * + * @param permission one of the "rights" defined for each protected resource + * in its ACL + * @return true if permission contained in the permission list for this + * <code>ACLEntry</code>; false otherwise. */ public boolean containPermission(String permission) { return (mPerms.get(permission) != null); @@ -139,15 +146,16 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Checks if this entry has the given permission. - * @param permission one of the "rights" defined for each - * protected resource in its ACL - * @return true if the permission is allowed; false if the - * permission is denied. If a permission is not - * recognized by this ACL, it is considered denied + * + * @param permission one of the "rights" defined for each protected resource + * in its ACL + * @return true if the permission is allowed; false if the permission is + * denied. If a permission is not recognized by this ACL, it is + * considered denied */ public boolean checkPermission(String permission) { // default - if we dont know about the requested permission, - // don't grant permission + // don't grant permission if (mPerms.get(permission) == null) return false; if (isNegative()) { @@ -159,10 +167,13 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Parse string in the following format: + * * <PRE> * allow|deny (right[,right...]) attribute_expression * </PRE> + * * into an instance of the <code>ACLEntry</code> class + * * @param acl the acl instance associated with this aclentry * @param aclEntryString aclEntryString in the specified format * @return an instance of the <code>ACLEntry</code> class @@ -175,7 +186,7 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { String te = aclEntryString.trim(); // locate first space - int i = te.indexOf(' '); + int i = te.indexOf(' '); // prefix should be "allowed" or "deny" String prefix = te.substring(0, i); String suffix = te.substring(i + 1).trim(); @@ -189,7 +200,7 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { return null; } // locate the second space - i = suffix.indexOf(' '); + i = suffix.indexOf(' '); // this prefix should be rights list, delimited by "," prefix = suffix.substring(1, i - 1); // the suffix is the rest, which is the "expressions" @@ -206,6 +217,7 @@ public class ACLEntry implements IACLEntry, java.io.Serializable { /** * Returns the string representation of this ACLEntry + * * @return string representation of this ACLEntry */ public String toString() { |