ccc.domain
Class AccessPermission

java.lang.Object
  extended by ccc.domain.AccessPermission

public class AccessPermission
extends java.lang.Object

An access permission for a resource.

Author:
Civic Computing Ltd.

Constructor Summary
protected AccessPermission()
          Constructor.
  AccessPermission(boolean canRead, boolean canWrite, Principal principal)
          Constructor.
 
Method Summary
 boolean allowsRead(UserEntity user)
          Check whether this permission allows the specified user to read.
 boolean allowsWrite(UserEntity user)
          Check whether this permission allows the specified user to write.
 ACL.Entry createEntry()
          Create a new permission entry.
 boolean equals(java.lang.Object obj)
          
 Principal getPrincipal()
          Accessor.
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessPermission

protected AccessPermission()
Constructor.


AccessPermission

public AccessPermission(boolean canRead,
                        boolean canWrite,
                        Principal principal)
Constructor.

Parameters:
canRead - Can the principal perform a read.
canWrite - Can the principal perform a write.
principal - The principal this permission manages.
Method Detail

allowsRead

public boolean allowsRead(UserEntity user)
Check whether this permission allows the specified user to read.

Parameters:
user - The user to test.
Returns:
Returns true if a read is allowed; false otherwise.

allowsWrite

public boolean allowsWrite(UserEntity user)
Check whether this permission allows the specified user to write.

Parameters:
user - The user to test.
Returns:
Returns true if a write is allowed; false otherwise.

getPrincipal

public Principal getPrincipal()
Accessor.

Returns:
Returns the principal.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

createEntry

public ACL.Entry createEntry()
Create a new permission entry.

Returns:
The entry representing this permission.


Copyright © 2010. All Rights Reserved.