com.atlassian.jira.security.util
Class GroupSelectorUtils

java.lang.Object
  extended by com.atlassian.jira.security.util.GroupSelectorUtils

public class GroupSelectorUtils
extends Object

Hacky methods to support mapping a display name to a group name. A "display" name is a user-friendly equivalent of a regular group name, eg. "JIRA Developers" instead of "jira-developers". In addition, a group name ("Admins") may resolve to multiple groups ("jira-admins, qa-admins" etc).

This code is used in groupnames.jsp, GroupCF and InGroupCFCondition


Constructor Summary
GroupSelectorUtils(org.ofbiz.core.entity.GenericDelegator genericDelegator, FieldManager fieldManager)
           
 
Method Summary
 List getCustomFieldsSpecifyingGroups()
          Get all custom fields that could possibly be identifying a group.
 String getGroupDisplayName(Group group)
          Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.
 Set getGroups(Object cfValue)
          Given an object (usually a custom field value) find the associated group.
 Set getGroupsFromDisplayName(String groupDisplayName)
          Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.
 Set getUsers(Issue issue, String customFieldId)
          Get users from a group chosen by a Group Selector custom field, in a certain issue.
 boolean isUserInCustomFieldGroup(Issue issue, CustomField field, User user)
          Determines if a user is a member of a group specified by a custom field value.
 String printGroups(Collection groups)
          Print a comma-separated list of groups.
 boolean updateGroupName(Group group, String oldVal, String newVal)
          Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupSelectorUtils

public GroupSelectorUtils(org.ofbiz.core.entity.GenericDelegator genericDelegator,
                          FieldManager fieldManager)
Method Detail

getUsers

public Set getUsers(Issue issue,
                    String customFieldId)
Get users from a group chosen by a Group Selector custom field, in a certain issue.

Parameters:
issue -
customFieldId - Id of GroupSelectorField.
Returns:
Set of Users.

getCustomFieldsSpecifyingGroups

public List getCustomFieldsSpecifyingGroups()
Get all custom fields that could possibly be identifying a group. For example, select-lists, text fields.

Returns:
list of Field objects, never null

isUserInCustomFieldGroup

public boolean isUserInCustomFieldGroup(Issue issue,
                                        CustomField field,
                                        User user)
Determines if a user is a member of a group specified by a custom field value.

Parameters:
issue - The current issue
field - The custom field specifying the group(s). Eg. a select-list.
user - The user we wish to check for
Returns:
If user is in one of the groups specified by the custom field.

getGroups

public Set getGroups(Object cfValue)
Given an object (usually a custom field value) find the associated group.

Parameters:
cfValue - A String (eg. "JIRA Developers" or "jira-developers") Group or Collection of Strings or Groups.
Returns:
A Set of Groups.

printGroups

public String printGroups(Collection groups)
Print a comma-separated list of groups. Useful in debugging code.


getGroupsFromDisplayName

public Set getGroupsFromDisplayName(String groupDisplayName)
                             throws org.ofbiz.core.entity.GenericEntityException
Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.

Given a display name, return a group name if one is mapped.

Parameters:
groupDisplayName - Eg. "JIRA Developers"
Returns:
A set of Groups, eg. [jira-developers], or null if none exists for the given display name.
Throws:
org.ofbiz.core.entity.GenericEntityException

getGroupDisplayName

public final String getGroupDisplayName(Group group)
                                 throws org.ofbiz.core.entity.GenericEntityException
Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.

Get a group's display name.

Returns:
The display name, or null if not set.
Throws:
org.ofbiz.core.entity.GenericEntityException

updateGroupName

public boolean updateGroupName(Group group,
                               String oldVal,
                               String newVal)
                        throws org.ofbiz.core.entity.GenericEntityException
Deprecated. since v3.8 this is a very short term method as it will not work with external User/Group management.

Update a group's display name.

Parameters:
group - Group to update
oldVal - The old value, if any (can be null)
newVal - New display name
Returns:
true if the display name was updated.
Throws:
org.ofbiz.core.entity.GenericEntityException


Copyright © 2002-2009 Atlassian. All Rights Reserved.