r107207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107206‎ | r107207 | r107208 >
Date:16:00, 24 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
do only display add new control to people that can use it
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -136,8 +136,14 @@
137137 *
138138 * @param IContextSource $context
139139 * @param array $args
 140+ *
 141+ * @return boolean
140142 */
141143 public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
 144+ if ( !$context->getUser()->isAllowed( 'epadmin' ) ) {
 145+ return false;
 146+ }
 147+
142148 $out = $context->getOutput();
143149
144150 $out->addHTML( Html::openElement(
@@ -171,6 +177,8 @@
172178 $out->addHTML( Html::hidden( 'newEditToken', $context->getUser()->editToken() ) );
173179
174180 $out->addHTML( '</fieldset></form>' );
 181+
 182+ return true;
175183 }
176184
177185 /**
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -157,8 +157,14 @@
158158 *
159159 * @param IContextSource $context
160160 * @param array $args
 161+ *
 162+ * @return boolean
161163 */
162164 public static function displayAddNewControl( IContextSource $context, array $args ) {
 165+ if ( !$context->getUser()->isAllowed( 'epmentor' ) ) {
 166+ return false;
 167+ }
 168+
163169 $out = $context->getOutput();
164170
165171 $out->addHTML( Html::openElement(
@@ -197,6 +203,8 @@
198204 $out->addHTML( Html::hidden( 'newEditToken', $context->getUser()->editToken() ) );
199205
200206 $out->addHTML( '</fieldset></form>' );
 207+
 208+ return true;
201209 }
202210
203211 /**
Index: trunk/extensions/EducationProgram/includes/EPCourse.php
@@ -155,8 +155,14 @@
156156 *
157157 * @param IContextSource $context
158158 * @param array $args
 159+ *
 160+ * @return boolean
159161 */
160162 public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
 163+ if ( !$context->getUser()->isAllowed( 'epmentor' ) ) {
 164+ return false;
 165+ }
 166+
161167 $out = $context->getOutput();
162168
163169 $out->addHTML( Html::openElement(
@@ -207,6 +213,8 @@
208214 $out->addHTML( Html::hidden( 'newEditToken', $context->getUser()->editToken() ) );
209215
210216 $out->addHTML( '</fieldset></form>' );
 217+
 218+ return true;
211219 }
212220
213221 /**

Status & tagging log