com.sap.security.api.permissions

Class NamePermission

java.lang.Object
  extended by java.security.Permission
      extended by com.sap.security.api.permissions.NamePermission
All Implemented Interfaces:
Serializable, Guard
Direct Known Subclasses:
ActionPermission, ValuePermission

public class NamePermission
extends Permission
implements Serializable

The NamePermission class extends the Permission class, and can be used as the base class for permissions that want to follow the same (simple) naming convention as NamePermission.

The name for a NamePermission is the name of the given permission (for example, "Admin", "test", ...). There's no hierarchical name property.

The action string (inherited from Permission) is unused. Thus, NamePermission is commonly used as the base class for "named" permissions (ones that contain a name but no actions list; you either have the named permission or you don't.) Subclasses may implement actions on top of NamePermission, if desired.

See Also:
Permission, Serialized Form

Constructor Summary
NamePermission(String name)
          Creates a new NamePermission with the specified name.
NamePermission(String name, String actions)
          Creates a new NamePermission object with the specified name.
 
Method Summary
 boolean equals(Object obj)
          Checks two NamePermission objects for equality.
 String getActions()
          Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(Permission p)
          Checks if the specified permission is "implied" by this object.
 
Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamePermission

public NamePermission(String name)
Creates a new NamePermission with the specified name. Name is the symbolic name of the permission.

Parameters:
name - the name of the NamePermission.

NamePermission

public NamePermission(String name,
                      String actions)
Creates a new NamePermission object with the specified name. The name is the symbolic name of the NamePermission, and the actions String is currently unused. This constructor exists to instantiate new Permission objects.

Parameters:
name - the name of the NamePermission.
actions - ignored.
Method Detail

implies

public boolean implies(Permission p)
Checks if the specified permission is "implied" by this object.

More specifically, this method returns true if:

Specified by:
implies in class Permission
Parameters:
p - the permission to check against.
Returns:
true if the passed permission is equal to or implied by this permission, false otherwise.

equals

public boolean equals(Object obj)
Checks two NamePermission objects for equality. Checks that obj's class is the same as this object's class and has the same name as this object.

Specified by:
equals in class Permission
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a NamePermission, and has the same name as this NamePermission object, false otherwise.

hashCode

public int hashCode()
Returns the hash code value for this object. The hash code used is the hash code of the name, that is, getName().hashCode(), where getName is from the Permission superclass.

Specified by:
hashCode in class Permission
Returns:
a hash code value for this object.

getActions

public String getActions()
Returns the canonical string representation of the actions, which currently is the empty string "", since there are no actions.

Specified by:
getActions in class Permission
Returns:
the empty string "".
Access Rights

This class can be accessed from:


SC DC
[sap.com] ENGINEAPI [sap.com] com.sap.security.api.sda
[sap.com] ENGFACADE [sap.com] tc/je/usermanagement/api
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib


Copyright 2010 SAP AG Complete Copyright Notice