com.atlassian.bamboo.security.acegi.acls
Class BambooAclUpdateHelper

java.lang.Object
  extended by com.atlassian.bamboo.security.acegi.acls.BambooAclUpdateHelper

public class BambooAclUpdateHelper
extends java.lang.Object

A helper class used in Acl update and creation operations It converts between Acl and AccessControlEntry objects and a "permissionKey" which is a String representation of a Acl and AccessControlEntry combination. The "permissionKeys" are in the format: bambooPermission_TYPE_PRINCIPAL_PERMISSION The permission configuration UI understands this format.


Field Summary
static java.lang.String BAMBOO_PERMISSION_FORM_GROUP
           
static java.lang.String BAMBOO_PERMISSION_FORM_GROUP_PREFIX
           
static java.lang.String BAMBOO_PERMISSION_FORM_ROLE
           
static java.lang.String BAMBOO_PERMISSION_FORM_ROLE_PREFIX
           
static java.lang.String BAMBOO_PERMISSION_FORM_SEPARATOR
           
static java.lang.String BAMBOO_PERMISSION_FORM_USER
           
static java.lang.String BAMBOO_PERMISSION_FORM_USER_PREFIX
           
static java.lang.String BAMBOO_PERMISSION_PREFIX
           
 
Constructor Summary
BambooAclUpdateHelper()
           
 
Method Summary
 void buildPermissionAndUserGroupListsFromAcl(java.util.List<java.lang.String> grantedPermissions, java.util.List<java.lang.String> grantedUsers, java.util.List<java.lang.String> grantedGroups, java.util.List<java.lang.String> nonProcessedGrantedPermissions, org.acegisecurity.acls.Acl acl, boolean showAdminPermissions, BambooPermissionManager bambooPermissionManager)
          Helper conversion method for the permission configuration pages.
 java.util.List<java.lang.String> buildPermissionListFromRequest(java.util.Map<java.lang.String,java.lang.String[]> param)
          Builds a list of permissionKeys from the request Map
 void buildUserGroupListsFromPermissions(java.util.List<java.lang.String> grantedPermissions, java.util.List<java.lang.String> grantedUsers, java.util.List<java.lang.String> grantedGroups)
          Given a list of granted permissions (permissionKey Strings), it will populate the grantedUsers list with unique usernames of those users which have permissions.
 org.acegisecurity.acls.MutableAcl createNewDefaultAcl(com.atlassian.user.User user)
          Creates a default Acl for a DefaultBuild plan type which has: - All permissions for the creator (user argument) of the plan - READ permission for all logged in users - READ permission for all anonymous users
 org.acegisecurity.acls.MutableAcl createNewDefaultAcl(com.atlassian.user.User user, java.lang.Class planType)
          Creates a default Acl for a specific plan types which has: - All permissions for the creator (user argument) of the plan - READ permission for all logged in users - READ permission for all anonymous users
 java.lang.String getPermissionKeyFromAce(org.acegisecurity.acls.AccessControlEntry ace)
          Given an AccessControlEntry return a String representation.
 void modifyAclAces(org.acegisecurity.acls.MutableAcl acl, java.util.List<java.lang.String> newPermissionKeys)
          Updates an MutableAcl with new AccessControlEntrys with permissions represented by a list of String permissionKeys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAMBOO_PERMISSION_FORM_SEPARATOR

public static final java.lang.String BAMBOO_PERMISSION_FORM_SEPARATOR
See Also:
Constant Field Values

BAMBOO_PERMISSION_FORM_USER

public static final java.lang.String BAMBOO_PERMISSION_FORM_USER
See Also:
Constant Field Values

BAMBOO_PERMISSION_FORM_GROUP

public static final java.lang.String BAMBOO_PERMISSION_FORM_GROUP
See Also:
Constant Field Values

BAMBOO_PERMISSION_FORM_ROLE

public static final java.lang.String BAMBOO_PERMISSION_FORM_ROLE
See Also:
Constant Field Values

BAMBOO_PERMISSION_PREFIX

public static java.lang.String BAMBOO_PERMISSION_PREFIX

BAMBOO_PERMISSION_FORM_USER_PREFIX

public static final java.lang.String BAMBOO_PERMISSION_FORM_USER_PREFIX

BAMBOO_PERMISSION_FORM_GROUP_PREFIX

public static final java.lang.String BAMBOO_PERMISSION_FORM_GROUP_PREFIX

BAMBOO_PERMISSION_FORM_ROLE_PREFIX

public static final java.lang.String BAMBOO_PERMISSION_FORM_ROLE_PREFIX
Constructor Detail

BambooAclUpdateHelper

public BambooAclUpdateHelper()
Method Detail

buildPermissionListFromRequest

public java.util.List<java.lang.String> buildPermissionListFromRequest(java.util.Map<java.lang.String,java.lang.String[]> param)
Builds a list of permissionKeys from the request Map

Parameters:
param - - param list from action.
Returns:
List of Strings representing permissions in the request map

buildUserGroupListsFromPermissions

public void buildUserGroupListsFromPermissions(java.util.List<java.lang.String> grantedPermissions,
                                               java.util.List<java.lang.String> grantedUsers,
                                               java.util.List<java.lang.String> grantedGroups)
Given a list of granted permissions (permissionKey Strings), it will populate the grantedUsers list with unique usernames of those users which have permissions. Likewise, it will populate the grantedGroups list with unique group names of those groups which have permssions.

Parameters:
grantedPermissions -
grantedUsers -
grantedGroups -

buildPermissionAndUserGroupListsFromAcl

public void buildPermissionAndUserGroupListsFromAcl(@NotNull
                                                    java.util.List<java.lang.String> grantedPermissions,
                                                    @NotNull
                                                    java.util.List<java.lang.String> grantedUsers,
                                                    @NotNull
                                                    java.util.List<java.lang.String> grantedGroups,
                                                    @NotNull
                                                    java.util.List<java.lang.String> nonProcessedGrantedPermissions,
                                                    @NotNull
                                                    org.acegisecurity.acls.Acl acl,
                                                    boolean showAdminPermissions,
                                                    @NotNull
                                                    BambooPermissionManager bambooPermissionManager)
Helper conversion method for the permission configuration pages. Takes in an Acl and populates three lists from this Acl: - grantedPermissions - a list of String in format: bambooPermission_TYPE_PRINCIPAL_PERMISSION - grantedUsers - a list of String usernames - who have at least one AccessControlEntry against the Acl - grantedGroups - a list of String groupnames - who have at least one AccessControlEntry against the Acl - nonProcessedGrantedPermissions - a list of permissions, that are not processed - so could not be changed here. It is introduced to avoid cleaning up permissions, that are not visible for user performing this action

Parameters:
grantedPermissions -
grantedUsers -
grantedGroups -
nonProcessedGrantedPermissions -
acl -
showAdminPermissions -
bambooPermissionManager -

modifyAclAces

public void modifyAclAces(org.acegisecurity.acls.MutableAcl acl,
                          java.util.List<java.lang.String> newPermissionKeys)
Updates an MutableAcl with new AccessControlEntrys with permissions represented by a list of String permissionKeys.

Parameters:
acl -
newPermissionKeys -

getPermissionKeyFromAce

public java.lang.String getPermissionKeyFromAce(org.acegisecurity.acls.AccessControlEntry ace)
Given an AccessControlEntry return a String representation.

Parameters:
ace -
Returns:

createNewDefaultAcl

public org.acegisecurity.acls.MutableAcl createNewDefaultAcl(@NotNull
                                                             com.atlassian.user.User user)
Creates a default Acl for a DefaultBuild plan type which has: - All permissions for the creator (user argument) of the plan - READ permission for all logged in users - READ permission for all anonymous users

Parameters:
user - to create acl for.
Returns:
MutableAcl representing a default permission set

createNewDefaultAcl

public org.acegisecurity.acls.MutableAcl createNewDefaultAcl(@NotNull
                                                             com.atlassian.user.User user,
                                                             java.lang.Class planType)
Creates a default Acl for a specific plan types which has: - All permissions for the creator (user argument) of the plan - READ permission for all logged in users - READ permission for all anonymous users

Parameters:
user - to create acl for.
planType - to create acl for.
Returns:
MutableAcl representing a default permission set


Copyright © 2010 Atlassian. All Rights Reserved.