src/Administration.php
public function doesUserHaveRole($userId, $role) {
		if (empty($role) || !\is_numeric($role)) {
			return false;
		}

		$userId = (int) $userId;

		$rolesBitmask = $this->db->selectValue(
			'SELECT roles_mask FROM ' . $this->makeTableName('users') . ' WHERE id = ?',
			[ $userId ]
		);

		if ($rolesBitmask === null) {
			throw new UnknownIdException();
		}

		$role = (int) $role;

		return ($rolesBitmask & $role) === $role;
	}
public function doesUserHaveRole($userId, $role) {
		if (empty($role) || !\is_numeric($role)) {
			return false;
		}

		$userId = (int) $userId;

		$rolesBitmask = $this->db->selectValue(
			'SELECT roles_mask FROM ' . $this->makeTableName('users') . ' WHERE id = ?',
			[ $userId ]
		);

		if ($rolesBitmask === null) {
			throw new UnknownIdException();
		}

		$role = (int) $role;

		return ($rolesBitmask & $role) === $role;
	}
public function doesUserHaveRole ( $ userId , $ role ) { if ( empty ( $ role ) || ! \ is_numeric ( $ role ) ) { return false ; } $ userId = ( int ) $ userId ; $ rolesBitmask = $ this -> db -> selectValue ( 'SELECT roles_mask FROM ' . $ this -> makeTableName ( 'users' ) . ' WHERE id = ?' , [ $ userId ] ) ; if ( $ rolesBitmask === null ) { throw new UnknownIdException ( ) ; } $ role = ( int ) $ role ; return ( $ rolesBitmask & $ role ) === $ role ; }
Returns whether the user with the given ID has the specified role

@param int $userId the ID of the user to check the roles for
@param int $role the role as one of the constants from the {@see Role} class
@return bool
@throws UnknownIdException if no user with the specified ID has been found

@see Role
Returns whether the user with the given ID has the specified role