src/Administration.php
public function addRoleForUserByUsername($username, $role) {
		$userData = $this->getUserDataByUsername(
			\trim($username),
			[ 'id' ]
		);

		$this->addRoleForUserByColumnValue(
			'id',
			(int) $userData['id'],
			$role
		);
	}
public function addRoleForUserByUsername($username, $role) {
		$userData = $this->getUserDataByUsername(
			\trim($username),
			[ 'id' ]
		);

		$this->addRoleForUserByColumnValue(
			'id',
			(int) $userData['id'],
			$role
		);
	}
public function addRoleForUserByUsername ( $ username , $ role ) { $ userData = $ this -> getUserDataByUsername ( \ trim ( $ username ) , [ 'id' ] ) ; $ this -> addRoleForUserByColumnValue ( 'id' , ( int ) $ userData [ 'id' ] , $ role ) ; }
Assigns the specified role to the user with the given username

A user may have any number of roles (i.e. no role at all, a single role, or any combination of roles)

@param string $username the username of the user to assign the role to
@param int $role the role as one of the constants from the {@see Role} class
@throws UnknownUsernameException if no user with the specified username has been found
@throws AmbiguousUsernameException if multiple users with the specified username have been found

@see Role
Assigns the specified role to the user with the given username