net.sourceforge.sconman
Class PermissionAggregator

java.lang.Object
  extended by net.sourceforge.sconman.PermissionAggregator
Direct Known Subclasses:
Role, User

 class PermissionAggregator
extends java.lang.Object

Author:
mballesteros

Field Summary
(package private)  java.util.List permissions
          The list of permissions
(package private)  SecurityContext sctx
          The securoty context
 
Constructor Summary
PermissionAggregator(SecurityContext sctx)
          Main constructor
 
Method Summary
 void addAddNewPermission(User actor, ContentType ctype)
          Adds permissions to create new contents of given content type.
 void addAdminProjectPermission(User actor)
          Adds permissions to admin project.
 void addDeletePermission(User actor, ContentType ctype)
          Adds permissions to do delete contents of given content type.
 void addModifyPermission(User actor, Category cat)
          Adds permissions to modify a category
 void addModifyPermission(User actor, ContentType ctype)
          Adds permissions to modify contents of given content type.
(package private)  void addPermission(Permission permission)
           
(package private)  void addPermission(java.lang.String permission)
           
(package private)  void addPermissions(java.lang.String permission)
           
 void addViewPermission(User actor, Category cat)
          Adds a permission to view a category
 void addViewPermission(User actor, ContentType ctype)
          Adds permissions to view contents of given content type.
(package private)  java.util.List getPermissions()
          Return the role permissions
(package private)  java.lang.String getPermissionsAsString()
          Return the role permissions, as a CSV String
 boolean hasAddNewPermission(ContentType ctype)
          Checks whether the aggregator can create new contents of the given type
 boolean hasAdminProjectPermission()
          Checks that the user can manage the project (Manage Roles and Users)
 boolean hasDeletePermission(Category cat)
          Checks whether the aggregator can remove a category
 boolean hasDeletePermission(ContentType ctype)
          Checks whether the aggregator can delete that content type
 boolean hasModifyPermission(Category cat)
          Checks whether the aggregator can modify a category
 boolean hasModifyPermission(ContentType ctype)
          Checks whether the aggregator can modify that content type
(package private)  boolean hasPermission(Permission permission)
           
(package private)  boolean hasPermission(java.lang.String permission)
           
 boolean hasViewPermission(Category cat)
          Checks whether the aggregator can view a category
 boolean hasViewPermission(ContentType ctype)
          Checks whether the aggregator can view that content type
 void removeAddNewPermission(User actor, ContentType ctype)
          Removes permissions to create new contents of given content type.
 void removeAdminProjectPermission(User actor)
          Removes permission to admin project.
(package private)  void removeAllPermissions()
           
 void removeAllPermissions(User actor)
          Removes all the Permissions
 void removeDeletePermission(User actor, ContentType ctype)
          Removes permissions to do delete contents of given content type.
 void removeModifyPermission(User actor, Category cat)
          Removes permissions to modify a category
 void removeModifyPermission(User actor, ContentType ctype)
          Removes permissions to modify contents of given content type.
(package private)  void removePermission(Permission permission)
           
(package private)  void removePermission(java.lang.String permission)
           
 void removeViewPermission(User actor, Category cat)
          Removes a permission to view a category
 void removeViewPermission(User actor, ContentType ctype)
          Removes permissions to view contents of given content type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sctx

SecurityContext sctx
The securoty context


permissions

java.util.List permissions
The list of permissions

Constructor Detail

PermissionAggregator

PermissionAggregator(SecurityContext sctx)
Main constructor

Parameters:
sctx -
id -
Method Detail

addViewPermission

public void addViewPermission(User actor,
                              Category cat)
                       throws SCMSecurityException
Adds a permission to view a category

Parameters:
actor - The user that performs the action
cat - The category that the user must view
Throws:
SCMSecurityException - Thrown when the actor cannot modify permissions

removeViewPermission

public void removeViewPermission(User actor,
                                 Category cat)
                          throws SCMSecurityException
Removes a permission to view a category

Parameters:
actor - The user that performs the action
cat - The category that the user must view
Throws:
SCMSecurityException - Thrown when the actor cannot modify permissions

addModifyPermission

public void addModifyPermission(User actor,
                                Category cat)
                         throws SCMSecurityException
Adds permissions to modify a category

Parameters:
actor - The user that performs the action
cat - The category that the user must modify Category
Throws:
SCMSecurityException - Thrown when the actor cannot modify permissions

removeModifyPermission

public void removeModifyPermission(User actor,
                                   Category cat)
                            throws SCMSecurityException
Removes permissions to modify a category

Parameters:
actor - The user that performs the action
cat - The category that the user must modify Category
Throws:
SCMSecurityException - Thrown when the actor cannot modify permissions

addAddNewPermission

public void addAddNewPermission(User actor,
                                ContentType ctype)
                         throws SCMSecurityException
Adds permissions to create new contents of given content type. Permissions to view and modify the content type's default category are added also.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

removeAddNewPermission

public void removeAddNewPermission(User actor,
                                   ContentType ctype)
                            throws SCMSecurityException
Removes permissions to create new contents of given content type. Remember that this action doesn't remove Permissions to view and modify the content type's default category.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

addViewPermission

public void addViewPermission(User actor,
                              ContentType ctype)
                       throws SCMSecurityException
Adds permissions to view contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

removeViewPermission

public void removeViewPermission(User actor,
                                 ContentType ctype)
                          throws SCMSecurityException
Removes permissions to view contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

addModifyPermission

public void addModifyPermission(User actor,
                                ContentType ctype)
                         throws SCMSecurityException
Adds permissions to modify contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

removeModifyPermission

public void removeModifyPermission(User actor,
                                   ContentType ctype)
                            throws SCMSecurityException
Removes permissions to modify contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

addDeletePermission

public void addDeletePermission(User actor,
                                ContentType ctype)
                         throws SCMSecurityException
Adds permissions to do delete contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

removeDeletePermission

public void removeDeletePermission(User actor,
                                   ContentType ctype)
                            throws SCMSecurityException
Removes permissions to do delete contents of given content type.

Parameters:
actor -
ctype -
Throws:
SCMSecurityException

addAdminProjectPermission

public void addAdminProjectPermission(User actor)
                               throws SCMSecurityException
Adds permissions to admin project.

Parameters:
actor - User who gives Permission
Throws:
SCMSecurityException

removeAdminProjectPermission

public void removeAdminProjectPermission(User actor)
                                  throws SCMSecurityException
Removes permission to admin project.

Parameters:
actor - User who removes Permission
Throws:
SCMSecurityException

hasAdminProjectPermission

public boolean hasAdminProjectPermission()
Checks that the user can manage the project (Manage Roles and Users)

Returns:

hasViewPermission

public boolean hasViewPermission(Category cat)
Checks whether the aggregator can view a category

Parameters:
cat -
Returns:

hasModifyPermission

public boolean hasModifyPermission(Category cat)
Checks whether the aggregator can modify a category

Parameters:
cat -
Returns:

hasDeletePermission

public boolean hasDeletePermission(Category cat)
Checks whether the aggregator can remove a category

Parameters:
cat -
Returns:

hasViewPermission

public boolean hasViewPermission(ContentType ctype)
Checks whether the aggregator can view that content type

Parameters:
ctype -
ctypePermissions -
Throws:
SCMSecurityException

hasModifyPermission

public boolean hasModifyPermission(ContentType ctype)
Checks whether the aggregator can modify that content type

Parameters:
ctype -
ctypePermissions -
Throws:
SCMSecurityException

hasDeletePermission

public boolean hasDeletePermission(ContentType ctype)
Checks whether the aggregator can delete that content type

Parameters:
ctype -
ctypePermissions -
Throws:
SCMSecurityException

hasAddNewPermission

public boolean hasAddNewPermission(ContentType ctype)
Checks whether the aggregator can create new contents of the given type

Parameters:
ctype -
ctypePermissions -
Throws:
SCMSecurityException

removeAllPermissions

public void removeAllPermissions(User actor)
                          throws SCMSecurityException
Removes all the Permissions

Parameters:
actor - User who removes all the permissions.
Throws:
SCMSecurityException

removeAllPermissions

void removeAllPermissions()

addPermission

void addPermission(Permission permission)

removePermission

void removePermission(Permission permission)

addPermission

void addPermission(java.lang.String permission)

addPermissions

void addPermissions(java.lang.String permission)

removePermission

void removePermission(java.lang.String permission)

hasPermission

boolean hasPermission(java.lang.String permission)

hasPermission

boolean hasPermission(Permission permission)

getPermissions

java.util.List getPermissions()
Return the role permissions

Returns:

getPermissionsAsString

java.lang.String getPermissionsAsString()
Return the role permissions, as a CSV String

Returns:


Copyright null null. All Rights Reserved.