@Override public void init() { groupManager = ComponentAccessor.getGroupManager(); }
/** * Checks if the recipient is in the specified group. If this is only an email address they are not in any group. * * @param groupName group name * @return <code>true</code> if the user is set and is in the group, <code>false</code> otherwise */ public boolean isInGroup(String groupName) { return user != null && ComponentAccessor.getGroupManager().isUserInGroup(user, groupName); }
private static boolean userInGroup(ApplicationUser user, String groupName) { return ComponentAccessor.getGroupManager().isUserInGroup(user, groupName); }
private boolean hasPermission(String groupName, ApplicationUser user) { if (user == null) { throw new IllegalArgumentException("User passed must not be null"); } // If there is no group then it is Anyone so it is true if (groupName == null) { return true; } GroupManager groupManager = ComponentAccessor.getGroupManager(); // JDEV-30356: Passing a user object instead of username means less work to do and so is faster return groupManager.isUserInGroup(user, groupName); }
@Override public boolean passesCondition(Map transientVars, Map args, PropertySet ps) { ApplicationUser caller = getCallerUser(transientVars, args); if (caller == null) { return false; } String groupname = (String) args.get("group"); return ComponentAccessor.getGroupManager().isUserInGroup(caller, groupname); } }
public List<Group> getFilteredGroups() throws Exception { @SuppressWarnings("unchecked") final Collection<Group> groups = ComponentAccessor.getGroupManager().getAllGroups(); if (nameFilter == null) { return new ArrayList<Group>(groups); } final List<Group> filteredGroups = Lists.newArrayListWithCapacity(groups.size()); // get list of filtered users for (final Group group : groups) { if ((nameFilter == null) || (group.getName().toLowerCase().indexOf(nameFilter.toLowerCase()) >= 0)) { filteredGroups.add(group); } } return filteredGroups; } }
/** * @param groupLevel */ public void setGroupLevel(final String groupLevel) { if (!StringUtils.isBlank(groupLevel)) { // make sure that people only set levels they are in final ApplicationUser user = getLoggedInUser(); if (user != null && ComponentAccessor.getGroupManager().isUserInGroup(user, groupLevel)) { if (!StringUtils.isBlank(groupLevel)) { this.groupLevel = groupLevel; } } } }
final GroupManager groupManager = ComponentAccessor.getGroupManager();
/** * Remove all permissions that have used this group * * @param group The name of the group that needs to be removed, must NOT be null and must be a real group */ public void removeGroupPermissions(final String group) throws RemoveException { notNull("group", group); notNull(ComponentAccessor.getGroupManager().getGroup(group)); ComponentAccessor.getGlobalPermissionManager().removePermissions(group); ComponentAccessor.getPermissionSchemeManager().removeEntities(GroupDropdown.DESC, group); //If there is issue level security check that otherwise the must be able to see the issue ComponentAccessor.getComponent(IssueSecuritySchemeManager.class).removeEntities(GroupDropdown.DESC, group); }