Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php |
— | — | @@ -108,14 +108,6 @@ |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * (non-PHPdoc) |
112 | | - * @see EPPager::getMultipleItemActions() |
113 | | - */ |
114 | | - protected function getMultipleItemActions() { |
115 | | - return array(); |
116 | | - } |
117 | | - |
118 | | - /** |
119 | | - * (non-PHPdoc) |
120 | 112 | * @see EPPager::hasActionsColumn() |
121 | 113 | */ |
122 | 114 | protected function hasActionsColumn() { |
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -162,5 +162,22 @@ |
163 | 163 | |
164 | 164 | return $links; |
165 | 165 | } |
| 166 | + |
| 167 | + /** |
| 168 | + * (non-PHPdoc) |
| 169 | + * @see EPPager::getMultipleItemActions() |
| 170 | + */ |
| 171 | + protected function getMultipleItemActions() { |
| 172 | + $actions = parent::getMultipleItemActions(); |
166 | 173 | |
| 174 | + if ( $this->getUser()->isAllowed( 'ep-org' ) ) { |
| 175 | + $actions[wfMsg( 'ep-pager-delete-selected' )] = array( |
| 176 | + 'class' => 'ep-pager-delete-selected', |
| 177 | + 'data-type' => ApiDeleteEducation::getTypeForClassName( $this->className ) |
| 178 | + ); |
| 179 | + } |
| 180 | + |
| 181 | + return $actions; |
| 182 | + } |
| 183 | + |
167 | 184 | } |
Index: trunk/extensions/EducationProgram/includes/EPTermPager.php |
— | — | @@ -198,6 +198,13 @@ |
199 | 199 | protected function getMultipleItemActions() { |
200 | 200 | $actions = parent::getMultipleItemActions(); |
201 | 201 | |
| 202 | + if ( $this->getUser()->isAllowed( 'ep-term' ) ) { |
| 203 | + $actions[wfMsg( 'ep-pager-delete-selected' )] = array( |
| 204 | + 'class' => 'ep-pager-delete-selected', |
| 205 | + 'data-type' => ApiDeleteEducation::getTypeForClassName( $this->className ) |
| 206 | + ); |
| 207 | + } |
| 208 | + |
202 | 209 | return $actions; |
203 | 210 | } |
204 | 211 | |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -246,14 +246,6 @@ |
247 | 247 | */ |
248 | 248 | protected function getMultipleItemActions() { |
249 | 249 | $actions = array(); |
250 | | - |
251 | | - if ( false ) { // TODO: $this->getUser()->isAllowed( 'epadmin' ) |
252 | | - $actions[wfMsg( 'ep-pager-delete-selected' )] = array( |
253 | | - 'class' => 'ep-pager-delete-selected', |
254 | | - 'data-type' => ApiDeleteEducation::getTypeForClassName( $this->className ) |
255 | | - ); |
256 | | - } |
257 | | - |
258 | 250 | return $actions; |
259 | 251 | } |
260 | 252 | |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | * @return boolean |
214 | 214 | */ |
215 | 215 | public static function displayAddNewControl( IContextSource $context, array $args = array() ) { |
216 | | - if ( !$context->getUser()->isAllowed( 'epmentor' ) ) { |
| 216 | + if ( !$context->getUser()->isAllowed( 'ep-course' ) ) { |
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
— | — | @@ -327,5 +327,22 @@ |
328 | 328 | htmlspecialchars( $this->getField( 'name' ) ) |
329 | 329 | ); |
330 | 330 | } |
| 331 | + |
| 332 | + /** |
| 333 | + * (non-PHPdoc) |
| 334 | + * @see EPPager::getMultipleItemActions() |
| 335 | + */ |
| 336 | + protected function getMultipleItemActions() { |
| 337 | + $actions = parent::getMultipleItemActions(); |
331 | 338 | |
| 339 | + if ( $this->getUser()->isAllowed( 'ep-course' ) ) { |
| 340 | + $actions[wfMsg( 'ep-pager-delete-selected' )] = array( |
| 341 | + 'class' => 'ep-pager-delete-selected', |
| 342 | + 'data-type' => ApiDeleteEducation::getTypeForClassName( $this->className ) |
| 343 | + ); |
| 344 | + } |
| 345 | + |
| 346 | + return $actions; |
| 347 | + } |
| 348 | + |
332 | 349 | } |
Index: trunk/extensions/EducationProgram/includes/EPMentorPager.php |
— | — | @@ -84,14 +84,6 @@ |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * (non-PHPdoc) |
88 | | - * @see EPPager::getMultipleItemActions() |
89 | | - */ |
90 | | - protected function getMultipleItemActions() { |
91 | | - return array(); |
92 | | - } |
93 | | - |
94 | | - /** |
95 | | - * (non-PHPdoc) |
96 | 88 | * @see EPPager::hasActionsColumn() |
97 | 89 | */ |
98 | 90 | protected function hasActionsColumn() { |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -353,13 +353,9 @@ |
354 | 354 | * @author Jeroen De Dauw |
355 | 355 | */ |
356 | 356 | $messages['qqq'] = array( |
357 | | - 'right-epadmin' => '{{doc-right|epadmin}}', |
358 | | - 'right-epstudent' => '{{doc-right|epstudent}}', |
359 | | - 'right-epmentor' => '{{doc-right|epmentor}}', |
| 357 | + 'right-' => '{{doc-right|}}', |
360 | 358 | |
361 | | - 'action-epadmin' => '{{doc-action|epadmin}}', |
362 | | - 'action-epstudent' => '{{doc-action|epstudent}}', |
363 | | - 'action-epmentor' => '{{doc-action|epmentor}}', |
| 359 | + 'action-' => '{{doc-action|}}', |
364 | 360 | |
365 | 361 | 'specialpages-group-education' => 'Special pages group, h2', |
366 | 362 | 'special-mycourses' => '{{doc-special|mycourses}}', |
Index: trunk/extensions/EducationProgram/api/ApiDeleteEducation.php |
— | — | @@ -25,8 +25,6 @@ |
26 | 26 | 'org' => 'EPOrg', |
27 | 27 | 'course' => 'EPCourse', |
28 | 28 | 'term' => 'EPTerm', |
29 | | - 'student' => 'EPStudent', |
30 | | - 'mentor' => 'EPMentor', |
31 | 29 | ); |
32 | 30 | |
33 | 31 | /** |
— | — | @@ -83,34 +81,7 @@ |
84 | 82 | * @return boolean |
85 | 83 | */ |
86 | 84 | protected function userIsAllowed( $type, array $params ) { |
87 | | - $user = $this->getUser(); |
88 | | - |
89 | | - if ( $type === 'student' ) { |
90 | | - return EPStudent::selectField( 'id', array( 'user_id' => $user->getId() ) ) === $params['id']; |
91 | | - } |
92 | | - |
93 | | - if ( $type === 'mentor' ) { |
94 | | - return EPMentor::selectField( 'id', array( 'user_id' => $user->getId() ) ) === $params['id']; |
95 | | - } |
96 | | - |
97 | | - if ( $user->isAllowed( 'epadmin' ) ) { |
98 | | - return true; |
99 | | - } |
100 | | - |
101 | | - if ( $user->isAllowed( 'epmentor' ) ) { |
102 | | - $mentor = new EPMentor( array( 'user_id' => $user->getId() ) ); |
103 | | - |
104 | | - if ( $mentor !== false ) { |
105 | | - if ( $type === 'course' ) { |
106 | | - return $mentor->hasCourse( array( 'id' => $params['id'] ) ); |
107 | | - } |
108 | | - elseif ( $type === 'term' ) { |
109 | | - return $mentor->hasTerm( array( 'id' => $params['id'] ) ); |
110 | | - } |
111 | | - } |
112 | | - } |
113 | | - |
114 | | - return false; |
| 85 | + return $this->getUser()->isAllowed( 'ep-' . $type ); |
115 | 86 | } |
116 | 87 | |
117 | 88 | /** |