summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/acl/AclEntryImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/util/src/netscape/security/acl/AclEntryImpl.java')
-rw-r--r--pki/base/util/src/netscape/security/acl/AclEntryImpl.java138
1 files changed, 71 insertions, 67 deletions
diff --git a/pki/base/util/src/netscape/security/acl/AclEntryImpl.java b/pki/base/util/src/netscape/security/acl/AclEntryImpl.java
index 471868816..46365f5d8 100644
--- a/pki/base/util/src/netscape/security/acl/AclEntryImpl.java
+++ b/pki/base/util/src/netscape/security/acl/AclEntryImpl.java
@@ -25,10 +25,11 @@ import java.util.Enumeration;
import java.util.Vector;
/**
- * This is a class that describes one entry that associates users
+ * This is a class that describes one entry that associates users
* or groups with permissions in the ACL.
* The entry may be used as a way of granting or denying permissions.
- * @author Satish Dharmaraj
+ *
+ * @author Satish Dharmaraj
*/
public class AclEntryImpl implements AclEntry {
private Principal user = null;
@@ -36,12 +37,13 @@ public class AclEntryImpl implements AclEntry {
private boolean negative = false;
/**
- * Construct an ACL entry that associates a user with permissions
+ * Construct an ACL entry that associates a user with permissions
* in the ACL.
+ *
* @param user The user that is associated with this entry.
*/
public AclEntryImpl(Principal user) {
- this.user = user;
+ this.user = user;
}
/**
@@ -51,128 +53,130 @@ public class AclEntryImpl implements AclEntry {
}
/**
- * Sets the principal in the entity. If a group or a
- * principal had already been set, a false value is
+ * Sets the principal in the entity. If a group or a
+ * principal had already been set, a false value is
* returned, otherwise a true value is returned.
+ *
* @param user The user that is associated with this entry.
- * @return true if the principal is set, false if there is
- * one already.
+ * @return true if the principal is set, false if there is
+ * one already.
*/
public boolean setPrincipal(Principal user) {
- if (this.user != null)
- return false;
- this.user = user;
- return true;
+ if (this.user != null)
+ return false;
+ this.user = user;
+ return true;
}
/**
- * This method sets the ACL to have negative permissions.
- * That is the user or group is denied the permission set
+ * This method sets the ACL to have negative permissions.
+ * That is the user or group is denied the permission set
* specified in the entry.
*/
public void setNegativePermissions() {
- negative = true;
+ negative = true;
}
/**
* Returns true if this is a negative ACL.
*/
public boolean isNegative() {
- return negative;
+ return negative;
}
/**
- * A principal or a group can be associated with multiple
+ * A principal or a group can be associated with multiple
* permissions. This method adds a permission to the ACL entry.
- * @param permission The permission to be associated with
- * the principal or the group in the entry.
- * @return true if the permission was added, false if the
- * permission was already part of the permission set.
+ *
+ * @param permission The permission to be associated with
+ * the principal or the group in the entry.
+ * @return true if the permission was added, false if the
+ * permission was already part of the permission set.
*/
public boolean addPermission(Permission permission) {
- if (permissionSet.contains(permission))
- return false;
+ if (permissionSet.contains(permission))
+ return false;
- permissionSet.addElement(permission);
+ permissionSet.addElement(permission);
- return true;
+ return true;
}
/**
* The method disassociates the permission from the Principal
- * or the Group in this ACL entry.
- * @param permission The permission to be disassociated with
- * the principal or the group in the entry.
- * @return true if the permission is removed, false if the
- * permission is not part of the permission set.
+ * or the Group in this ACL entry.
+ *
+ * @param permission The permission to be disassociated with
+ * the principal or the group in the entry.
+ * @return true if the permission is removed, false if the
+ * permission is not part of the permission set.
*/
public boolean removePermission(Permission permission) {
- return permissionSet.removeElement(permission);
+ return permissionSet.removeElement(permission);
}
/**
- * Checks if the passed permission is part of the allowed
+ * Checks if the passed permission is part of the allowed
* permission set in this entry.
- * @param permission The permission that has to be part of
- * the permission set in the entry.
- * @return true if the permission passed is part of the
- * permission set in the entry, false otherwise.
+ *
+ * @param permission The permission that has to be part of
+ * the permission set in the entry.
+ * @return true if the permission passed is part of the
+ * permission set in the entry, false otherwise.
*/
public boolean checkPermission(Permission permission) {
- return permissionSet.contains(permission);
+ return permissionSet.contains(permission);
}
/**
* return an enumeration of the permissions in this ACL entry.
*/
public Enumeration<Permission> permissions() {
- return permissionSet.elements();
+ return permissionSet.elements();
}
/**
- * Return a string representation of the contents of the ACL entry.
+ * Return a string representation of the contents of the ACL entry.
*/
public String toString() {
- StringBuffer s = new StringBuffer();
- if (negative)
- s.append("-");
- else
- s.append("+");
- if (user instanceof Group)
- s.append("Group.");
- else
- s.append("User.");
- s.append(user + "=");
- Enumeration<Permission> e = permissions();
- while(e.hasMoreElements()) {
- Permission p = (Permission) e.nextElement();
- s.append(p);
- if (e.hasMoreElements())
- s.append(",");
- }
- return new String(s);
+ StringBuffer s = new StringBuffer();
+ if (negative)
+ s.append("-");
+ else
+ s.append("+");
+ if (user instanceof Group)
+ s.append("Group.");
+ else
+ s.append("User.");
+ s.append(user + "=");
+ Enumeration<Permission> e = permissions();
+ while (e.hasMoreElements()) {
+ Permission p = (Permission) e.nextElement();
+ s.append(p);
+ if (e.hasMoreElements())
+ s.append(",");
+ }
+ return new String(s);
}
/**
* Clones an AclEntry.
*/
public synchronized Object clone() {
- AclEntryImpl cloned;
- cloned = new AclEntryImpl(user);
- cloned.permissionSet = new Vector<Permission>(permissionSet);
- cloned.negative = negative;
- return cloned;
+ AclEntryImpl cloned;
+ cloned = new AclEntryImpl(user);
+ cloned.permissionSet = new Vector<Permission>(permissionSet);
+ cloned.negative = negative;
+ return cloned;
}
/**
- * Return the Principal associated in this ACL entry.
- * The method returns null if the entry uses a group
+ * Return the Principal associated in this ACL entry.
+ * The method returns null if the entry uses a group
* instead of a principal.
*/
public Principal getPrincipal() {
- return user;
+ return user;
}
}
-
-