Last update: 2011-06-23

org.proteios.core
Class UserPermissions

java.lang.Object
  extended by org.proteios.core.UserPermissions

public class UserPermissions
extends Object

This class is used to specify permissions to share an item to users. It is a three-step procedure:

Don't forget to commit the transaction.

Version:
2.0
Author:
Nicklas
See Also:
ItemKey, GroupPermissions, ProjectPermissions
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Constructor Summary
UserPermissions()
          Create a new empty object.
UserPermissions(ItemKey itemKey)
          Create a new object, and initialise it with the permissions from a ItemKey.
 
Method Summary
 void addPermissions(User user, Set<Permission> permissions)
          Grant permissions to a user, keeping those that have already been set.
 Set<Permission> getPermissions(User user)
          Get the permissions for a user.
 void setPermissions(User user, Set<Permission> permissions)
          Grant permissions to a user.
 int size()
          Get the number of entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserPermissions

public UserPermissions()
Create a new empty object.


UserPermissions

public UserPermissions(ItemKey itemKey)
                throws InvalidDataException
Create a new object, and initialise it with the permissions from a ItemKey.

Parameters:
itemKey - The item key from which we take the current permissions
Throws:
InvalidDataException - If the item key is null
Method Detail

setPermissions

public void setPermissions(User user,
                           Set<Permission> permissions)
                    throws InvalidDataException
Grant permissions to a user. Use an empty Set or null to remove all permissions for the user.

Parameters:
user - The User
permissions - The permissions to grant
Throws:
InvalidDataException - If the user is null
See Also:
Permission

addPermissions

public void addPermissions(User user,
                           Set<Permission> permissions)
                    throws InvalidDataException
Grant permissions to a user, keeping those that have already been set.

Parameters:
user - The User
permissions - The permissions to grant
Throws:
InvalidDataException - If the user is null
See Also:
Permission

getPermissions

public Set<Permission> getPermissions(User user)
                               throws InvalidDataException
Get the permissions for a user.

Parameters:
user - The User for which we want to get the permission
Returns:
An Set containing the granted permissions, or an empty set if no permissions have been granted
Throws:
InvalidDataException - If the user is null
See Also:
Permission

size

public int size()
Get the number of entries.


Last update: 2011-06-23