com.flexive.shared.security
Class ACLAssignment

java.lang.Object
  extended by com.flexive.shared.security.ACLAssignment
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ACLAssignment
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

A concrete assignment of an ACL to a user group

Author:
Gregor Schober (gregor.schober@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Constructor Summary
protected ACLAssignment(long aclId, long groupId, ACL.Category category, LifeCycleInfo lifeCycleInfo)
          Constructor, all permissions flags are set to false
  ACLAssignment(long aclId, long groupId, boolean read, boolean edit, boolean relate, boolean delete, boolean export, boolean create, ACL.Category category, LifeCycleInfo lifeCycleInfo)
          Constructor.
 
Method Summary
 ACLAssignment clone()
          Creates a clone.
static ACLAssignment[] clone(ACLAssignment[] data)
          Clones the ACLAssignmentData array.
static ACLAssignment createNew(ACL acl, long groupId, ACL.Permission... permissions)
          Create a new ACLAssignment using permission sets
 ACL.Category getACLCategory()
          Returns the type of the ACL.
 long getAclId()
          Returns the unqiue ACL id this assignment belongs to.
 long getGroupId()
          Returns the id of the group the acl is assigned to.
 LifeCycleInfo getLifeCycleInfo()
          Get lifecycle information
 boolean getMayCreate()
          Return true if the ACLAssignment grants create permission.
 boolean getMayDelete()
          Return true if the ACLAssignmentImpl grants unassign permission.
 boolean getMayEdit()
          Return true if the ACLAssignmentImpl grants edit permission.
 boolean getMayExport()
          Return true if the ACLAssignmentImpl grants export permission.
 boolean getMayRead()
          Return true if the ACLAssignmentImpl grants read permission.
 boolean getMayRelate()
          Return true if the ACLAssignmentImpl grants relate permission.
 boolean getPermission(ACL.Permission permission, long ownerId, long userId)
          Check if the requested permission is granted
 boolean isOwnerGroupAssignment()
          Is this an assignment for the owner group?
 void setGroupId(long groupId)
          Setter for the group id
 void setMayCreate(boolean bMayCreate)
           
 void setMayDelete(boolean bMayDelete)
           
 void setMayEdit(boolean bMayEdit)
           
 void setMayExport(boolean bMayExport)
           
 void setMayRead(boolean bMayRead)
           
 void setMayRelate(boolean bMayRelate)
           
 java.lang.String toString()
          Returns a string representation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ACLAssignment

public ACLAssignment(long aclId,
                     long groupId,
                     boolean read,
                     boolean edit,
                     boolean relate,
                     boolean delete,
                     boolean export,
                     boolean create,
                     ACL.Category category,
                     LifeCycleInfo lifeCycleInfo)
Constructor.

Parameters:
aclId - the id
groupId - the assigned grou
read - the read permission
edit - the edit permission
relate - the relate permission
delete - the delete permission
export - the export permission
create - the create permission
category - the assignment category
lifeCycleInfo - the lifecycle information

ACLAssignment

protected ACLAssignment(long aclId,
                        long groupId,
                        ACL.Category category,
                        LifeCycleInfo lifeCycleInfo)
Constructor, all permissions flags are set to false

Parameters:
aclId - the id
groupId - the assigned grou
category - the assignment category
lifeCycleInfo - the lifecycle information
Method Detail

clone

public ACLAssignment clone()
                    throws java.lang.CloneNotSupportedException
Creates a clone.

Overrides:
clone in class java.lang.Object
Returns:
the clone
Throws:
java.lang.CloneNotSupportedException

clone

public static ACLAssignment[] clone(ACLAssignment[] data)
Clones the ACLAssignmentData array.

Parameters:
data - the array to clone
Returns:
the clone

getAclId

public long getAclId()
Returns the unqiue ACL id this assignment belongs to.

Returns:
the unqiue ACL id this assignment belongs to.

getMayRead

public boolean getMayRead()
Return true if the ACLAssignmentImpl grants read permission.

Returns:
true if the ACLAssignmentImpl grants read permission.

getMayEdit

public boolean getMayEdit()
Return true if the ACLAssignmentImpl grants edit permission.

Returns:
true if the ACLAssignmentImpl grants edit permission.

getMayRelate

public boolean getMayRelate()
Return true if the ACLAssignmentImpl grants relate permission.

Returns:
true if the ACLAssignmentImpl grants relate permission.

getMayDelete

public boolean getMayDelete()
Return true if the ACLAssignmentImpl grants unassign permission.

Returns:
true if the ACLAssignmentImpl grants unassign permission.

getMayExport

public boolean getMayExport()
Return true if the ACLAssignmentImpl grants export permission.

Returns:
true if the ACLAssignmentImpl grants export permission.

getMayCreate

public boolean getMayCreate()
Return true if the ACLAssignment grants create permission.

Returns:
true if the ACLAssignment grants create permission.

getGroupId

public long getGroupId()
Returns the id of the group the acl is assigned to.

Returns:
the id of the group the acl is assigned to

setGroupId

public void setGroupId(long groupId)
Setter for the group id

Parameters:
groupId - group id

getACLCategory

public ACL.Category getACLCategory()
Returns the type of the ACL.

Returns:
the type of the ACL

getLifeCycleInfo

public LifeCycleInfo getLifeCycleInfo()
Get lifecycle information

Returns:
lifecycle information

isOwnerGroupAssignment

public boolean isOwnerGroupAssignment()
Is this an assignment for the owner group?

Returns:
if this an assignment for the owner group?

toString

public java.lang.String toString()
Returns a string representation.

Overrides:
toString in class java.lang.Object
Returns:
a string representation

setMayRead

public void setMayRead(boolean bMayRead)

setMayEdit

public void setMayEdit(boolean bMayEdit)

setMayRelate

public void setMayRelate(boolean bMayRelate)

setMayDelete

public void setMayDelete(boolean bMayDelete)

setMayExport

public void setMayExport(boolean bMayExport)

setMayCreate

public void setMayCreate(boolean bMayCreate)

getPermission

public boolean getPermission(ACL.Permission permission,
                             long ownerId,
                             long userId)
Check if the requested permission is granted

Parameters:
permission - the permission to check
ownerId - id of the owner
userId - id of the calling user
Returns:
granted

createNew

public static ACLAssignment createNew(ACL acl,
                                      long groupId,
                                      ACL.Permission... permissions)
Create a new ACLAssignment using permission sets

Parameters:
acl - affected ACL
groupId - usergroup
permissions - set of permissions
Returns:
ACLAssignment