public function actionAssignRole($idOrEmail, $role)
    {
        if (!$user = $this->findUser($idOrEmail)) {
            return self::EXIT_CODE_ERROR;
        }
        $rbac = Podium::getInstance()->getRbac();
        if (!$role = $rbac->getRole($role)) {
            $this->stderr('No such role.' . PHP_EOL);
            return self::EXIT_CODE_ERROR;
        }
        if (strpos($role->name, 'podium') === 0) {
            $this->setPodiumUserRole($user, $role);
        } else {
            $rbac->assign($role, $user->id);
        }
        $this->stdout("user#{$user->id} has role '{$role->name}'" . PHP_EOL);
    }
public function actionAssignRole($idOrEmail, $role)
    {
        if (!$user = $this->findUser($idOrEmail)) {
            return self::EXIT_CODE_ERROR;
        }
        $rbac = Podium::getInstance()->getRbac();
        if (!$role = $rbac->getRole($role)) {
            $this->stderr('No such role.' . PHP_EOL);
            return self::EXIT_CODE_ERROR;
        }
        if (strpos($role->name, 'podium') === 0) {
            $this->setPodiumUserRole($user, $role);
        } else {
            $rbac->assign($role, $user->id);
        }
        $this->stdout("user#{$user->id} has role '{$role->name}'" . PHP_EOL);
    }
public function actionAssignRole ( $ idOrEmail , $ role ) { if ( ! $ user = $ this -> findUser ( $ idOrEmail ) ) { return self :: EXIT_CODE_ERROR ; } $ rbac = Podium :: getInstance ( ) -> getRbac ( ) ; if ( ! $ role = $ rbac -> getRole ( $ role ) ) { $ this -> stderr ( 'No such role.' . PHP_EOL ) ; return self :: EXIT_CODE_ERROR ; } if ( strpos ( $ role -> name , 'podium' ) === 0 ) { $ this -> setPodiumUserRole ( $ user , $ role ) ; } else { $ rbac -> assign ( $ role , $ user -> id ) ; } $ this -> stdout ( "user#{$user->id} has role '{$role->name}'" . PHP_EOL ) ; }
Changes forum user role.
@param int|string $idOrEmail internal podium user id or email
@param string $role one of 'podiumUser', 'podiumModerator', 'podiumAdmin' or other application defined role
Changes forum user role .