add one or more users to a particular role
TODO should this work with multiple roles?
@param usernames {string or string array} - list of names of users
@param rolename {string} - the name of the role that the users should be added to
7024
function(usernames, rolename) {
    if (_.isEmpty(usernames)) {
      return Promise.reject(new Error('One or more usernames must be provided'));
    }

    if (!_.isArray(usernames)) {
      usernames = [usernames];
    }

    return Role.findOne({
      name: rolename
    }).populate('users').then(function(role) {
      return User.find({
        username: usernames
      }).then(function(users) {
        role.users.add(_.pluck(users, 'id'));
        return role.save();
      });
    });
  }
1078913
@Deprecated
    public FeatureState addUsers(Collection<String> users) {
        Set<String> set = new LinkedHashSet<>();
        set.addAll(this.getUsers());
        set.addAll(users);
        String setAsString = Strings.trimToNull(Strings.join(set, ","));
        setParameter(UsernameActivationStrategy.PARAM_USERS, setAsString);
        return this;
    }
104488
public boolean hasRole(String roleName){
        if (roles != null) {
            for (String r : roles) {
                if (r.equals(roleName))
                    return true;
            }
        }
        return false;
    }
1159261
public function addRole($roleName)
    {
        if (empty($roleName)) {
            throw new PropertyNotValid('Role name cannot be empty.');
        }

        if ($this->hasRole($roleName)) {
            return;
        }

        $this->roles[] = $roleName;
    }
172898
public synchronized void addRoleMapping(final String roleName) {
        HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
        if (newRoles.containsKey(roleName) == false) {
            newRoles.put(roleName, new RoleMappingImpl(roleName));
            roleMappings = Collections.unmodifiableMap(newRoles);
        }
    }
971907
public function addRole($roleName)
    {
        if (true === is_string($roleName) && false === in_array($roleName, $this->roles)) {
            $this->roles[] = $roleName;
        }
        return $this;
    }
188528
public static function userHasRole($role , $username = null)
	{
		if ( is_null( $username ) ) $username = self::getCurrentUsername();
		if ( is_null( $username ) ) return false;
		if ( ! self::userExists( $username ) ) return false;
		if ( in_array( 'admin' , self::$auth['users'][ $username ]['roles'] ) ) return true;
		return ( in_array( $role , self::$auth['users'][ $username ]['roles'] ) );
	}
290656
public void setUsers(Set<PrincipalUser> users) {
        SystemAssert.requireArgument(users != null && !users.isEmpty(), "Users associated with a namespace cannot be null or empty.");
        this.users.clear();
        if (users != null && !users.isEmpty()) {
            this.users.addAll(users);
        }
    }
81151
function addUser(user) {
	var slElement = $(document.createElement("option"));
	slElement.attr("value", user);
	slElement.text(user);
	$("#usersList").append(slElement);
}
563359
def addUsersToRole(self, rolename, users):
        
        params = {
            "f" : "json",
            "rolename" : rolename,
            "users" : users
        }
        rURL = self._url + "/roles/addUsersToRole"
        return self._post(url=rURL, param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
185476
public static boolean hasAllRoles(String roleNames) {
        boolean hasAllRole = true;
        Subject subject = getSubject();
        if (subject != null && roleNames != null && roleNames.length() > 0) {
            // Iterate through roles and check to see if the user has one of the
            // roles
            for (String role : roleNames.split(NAMES_DELIMETER)) {
                if (!subject.hasRole(role.trim())) {
                    hasAllRole = false;
                    break;
                }
            }
        }
        return hasAllRole;
    }
63991
public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) {
		return restClient.post("users/" + username + "/groups/", userGroupsEntity,
				new HashMap<String, String>());
	}
1177079
@Override
    public Response recipients(Iterable<String> usernames) {
    	this.usernames.addAll(Sets.newHashSet(usernames));
    	return this;
    }
696121
public void setUserName(String userName) {
        SystemAssert.requireArgument(userName != null && !userName.isEmpty(), "Username cannot be null or empty.");
        this.userName = userName;
    }
134461
public function addRole($username, $role)
    {
        $user = $this->findUserByUsernameOrThrowException($username);
        if ($user->hasRole($role)) {
            return false;
        }

        $user->addRole($role);
        $this->userManager->updateUser($user);

        return true;
    }
88869
def add_user(self, attrs):
        
        username = attrs[self.key]
        if username in self.users:
            raise UserAlreadyExists(username, self.backend_name)
        self.users[username] = attrs
        self.users[username]['groups'] = set([])
406764
public void addUserToGroup(String username, String groupname) throws CmsException {

        m_securityManager.addUserToGroup(m_context, username, groupname, false);
    }