Add roles.

@param roles the roles to add.
515552
@Override
    public void addRoles(final Collection<String> roles) {
        CommonHelper.assertNotNull("roles", roles);
        this.roles.addAll(roles);
    }
147317
public function addRole(Role $role)
    {
        if (!in_array($role, $this->roles)) {
            $this->roles[] = $role;
            return true;
        }
        return false;
    }
39061
public function addRole($role)
    {
        if ($role instanceof Role) {
            $role = $role->id;
        }

        // We don't want a double up on roles
        if (false !== array_search($role, (array) $this->attributes['roles'])) {
            return false;
        }

        $this->attributes['roles'][] = $role;

        return true;
    }
530124
public void setRoleService(
		com.liferay.portal.kernel.service.RoleService roleService) {
		this.roleService = roleService;
	}
808701
private List<String> getUsersFor(Collection<String> roles){
		List<String> users = new HashList<>();
		for(String role: roles){
			if(roleMembershipRU.containsKey(role))
				users.addAll(roleMembershipRU.get(role));
		}
		return users;
	}
406805
public function setRoles(Collection $roles)
    {
        $this->roles->clear();
        foreach ($roles as $role) {
            $this->roles[] = $role;
        }
    }
870946
public function assignTasksRoles(array $roles)
    {
        foreach ($roles as $roles => $tasks) {
            $tasks = (array) $tasks;
            $roles = (array) $roles;

            foreach ($tasks as $task) {
                $this->builder->buildTask($task)->addRoles($roles);
            }
        }
    }
1169208
public void setRoleAliases(java.util.Collection<String> roleAliases) {
        if (roleAliases == null) {
            this.roleAliases = null;
            return;
        }

        this.roleAliases = new java.util.ArrayList<String>(roleAliases);
    }
1355010
public void addAllRoles(HashMap map) {

        for (int i = 0; i < roles.size(); i++) {
            Grantee role = (Grantee) roles.get(i);

            map.put(role.granteeName.name, role.roles);
        }
    }
121427
public function setRoles(\WobbleCode\UserBundle\Document\Role $roles)
    {
        $this->roles = $roles;

        return $this;
    }
85952
public function setRoles($roles)
    {
        if (!is_array($roles)) {
            $roles = [$roles];
        }

        $this->roles = $roles;

        return $this;
    }
1161812
protected void addAllGroupsToRole(Set<String> groups, String role) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "addAllGroupsToRole", new Object[] { groups, role });
        }
        Set<String> groupsForTheRole = roleToGroupMap.get(role);
        if (groupsForTheRole != null) {
            groupsForTheRole.addAll(groups);
        } else {
            groupsForTheRole = groups;
        }
        roleToGroupMap.put(role, groupsForTheRole);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "addAllGroupsToRole");
        }
    }
1084083
public void setAssociatedRoles(java.util.Collection<DBInstanceRole> associatedRoles) {
        if (associatedRoles == null) {
            this.associatedRoles = null;
            return;
        }

        this.associatedRoles = new com.amazonaws.internal.SdkInternalList<DBInstanceRole>(associatedRoles);
    }
605882
public void setRoles(java.util.Collection<PermissionInfo> roles) {
        if (roles == null) {
            this.roles = null;
            return;
        }

        this.roles = new java.util.ArrayList<PermissionInfo>(roles);
    }
398970
private void appendRoles(final StringBuilder builder, final User user) {
        for (final UserRoleName role : user.getRoles()) {
            append(builder, ",", role.name());
        }
    }
491838
def add_role(user, roles):
        
        def _add_role(role):
            user_role = UserRole()
            user_role.user_id = user.user_id
            user_role.role_id = role.role_id
            db.session.add(user_role)
            db.session.commit()
        [_add_role(role) for role in roles]
1373571
public Authorizations addRoles(String... roles) {
        for (String role : roles) {
            addRole(new Role(role));
        }

        return this;
    }