Call method with the same name it's defined with
[lhc/web/wiklou.git] / includes / api / ApiUserrights.php
index 80db29b..5e068cb 100644 (file)
@@ -38,6 +38,7 @@ class ApiUserrights extends ApiBase {
                $user = $this->getUrUser();
 
                $form = new UserrightsPage;
+               $form->setContext( $this->getContext() );
                $r['user'] = $user->getName();
                $r['userid'] = $user->getId();
                list( $r['added'], $r['removed'] ) =
@@ -62,15 +63,16 @@ class ApiUserrights extends ApiBase {
                $params = $this->extractRequestParams();
 
                $form = new UserrightsPage;
+               $form->setContext( $this->getContext() );
                $status = $form->fetchUser( $params['user'] );
                if ( !$status->isOK() ) {
-                       $errors = $status->getErrorsArray();
-                       $this->dieUsageMsg( $errors[0] );
+                       $this->dieStatus( $status );
                } else {
                        $user = $status->value;
                }
 
                $this->mUser = $user;
+
                return $user;
        }