AndyRussG has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/160901

Change subject: Fix RemoveStudentAction after API token overhaul
......................................................................

Fix RemoveStudentAction after API token overhaul

A change in how core API classes handle made it necessary for
RemoveStudentAction to send a token when calling ApiEnlist
internally.

See I2793a3f2dd64a4bebb0b4d065e09af1e9f63fb89.

Change-Id: Ic5cf342bbb5ea2c89a1236b256ce86b3419992c8
---
M includes/actions/RemoveStudentAction.php
1 file changed, 16 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram 
refs/changes/01/160901/1

diff --git a/includes/actions/RemoveStudentAction.php 
b/includes/actions/RemoveStudentAction.php
index efee72f..c3f7c50 100644
--- a/includes/actions/RemoveStudentAction.php
+++ b/includes/actions/RemoveStudentAction.php
@@ -26,15 +26,22 @@
         * @see FormlessAction::onView()
         */
        public function onView() {
-               $api = new \ApiMain( new \FauxRequest( array(
-                       'action' => 'enlist',
-                       'subaction' => 'remove',
-                       'format' => 'json',
-                       'courseid' => $this->getRequest()->getInt( 'course-id' 
),
-                       'userid' => $this->getRequest()->getInt( 'user-id' ),
-                       'reason' => '', // TODO high
-                       'role' => 'student'
-               ), true ), true );
+
+               $req = $this->getRequest();
+
+               $api = new \ApiMain( new \DerivativeRequest(
+                       $req,
+                       array(
+                               'action' => 'enlist',
+                               'subaction' => 'remove',
+                               'format' => 'json',
+                               'courseid' => $req->getInt( 'course-id' ),
+                               'userid' => $req->getInt( 'user-id' ),
+                               'token' => $this->getUser()->getEditToken(),
+                               'reason' => '', // TODO high
+                               'role' => 'student'
+                       ),
+                       true ), true);
 
                try { $api->execute(); } catch ( \Exception $exception ) {}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/160901
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5cf342bbb5ea2c89a1236b256ce86b3419992c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: AndyRussG <andrew.green...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to