org.liquidsite.core.content
Class Permission

java.lang.Object
  extended byorg.liquidsite.core.content.Permission

public class Permission
extends java.lang.Object

A content object permission.


Constructor Summary
Permission(User user, Group group)
          Creates a new permission with default values.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks if this permission equals another object.
 boolean equals(Permission obj)
          Checks if this permission equals another object.
 boolean getAdmin()
          Returns the admin permission flag.
 java.lang.String getGroupName()
          Returns the permission group name.
 boolean getPublish()
          Returns the publish permission flag.
 boolean getRead()
          Returns the read permission flag.
 java.lang.String getUserName()
          Returns the permission user name.
 boolean getWrite()
          Returns the write permission flag.
 boolean isMatch(User user, Group[] groups)
          Checks if the specified user or group list matches this permission.
 void setAdmin(boolean admin)
          Sets the admin permission flag.
 void setPublish(boolean publish)
          Sets the publish permission flag.
 void setRead(boolean read)
          Sets the read permission flag.
 void setWrite(boolean write)
          Sets the write permission flag.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Permission

public Permission(User user,
                  Group group)
Creates a new permission with default values.

Parameters:
user - the user, or null for any user
group - the gruop, or null for any group
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks if this permission equals another object. This method will only return true if the other object is a permission with the same user and group.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical permission, or false otherwise

equals

public boolean equals(Permission obj)
Checks if this permission equals another object. This method will only return true if the other object is a permission with the same user and group.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical permission, or false otherwise

toString

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

Returns:
a string representation of this object

getUserName

public java.lang.String getUserName()
Returns the permission user name.

Returns:
the permission user name

getGroupName

public java.lang.String getGroupName()
Returns the permission group name.

Returns:
the permission group name

getRead

public boolean getRead()
Returns the read permission flag.

Returns:
the read permission flag

setRead

public void setRead(boolean read)
Sets the read permission flag.

Parameters:
read - the new read permission flag

getWrite

public boolean getWrite()
Returns the write permission flag.

Returns:
the write permission flag

setWrite

public void setWrite(boolean write)
Sets the write permission flag.

Parameters:
write - the new write permission flag

getPublish

public boolean getPublish()
Returns the publish permission flag.

Returns:
the publish permission flag

setPublish

public void setPublish(boolean publish)
Sets the publish permission flag.

Parameters:
publish - the new publish permission flag

getAdmin

public boolean getAdmin()
Returns the admin permission flag.

Returns:
the admin permission flag

setAdmin

public void setAdmin(boolean admin)
Sets the admin permission flag.

Parameters:
admin - the new admin permission flag

isMatch

public boolean isMatch(User user,
                       Group[] groups)
Checks if the specified user or group list matches this permission. The list of groups should be the user groups, and both must be in the same domain as the permission reference object.

Parameters:
user - the user to check, or null for none
groups - the group list to check, or null for none
Returns:
true if this permission matches, or false otherwise