http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99641
Revision: 99641
Author: jeroendedauw
Date: 2011-10-12 17:53:54 +0000 (Wed, 12 Oct 2011)
Log Message:
-----------
do not show contest admin for users that cannot access it
Modified Paths:
--------------
trunk/extensions/Contest/specials/SpecialContestSignup.php
trunk/extensions/Contest/specials/SpecialContests.php
Modified: trunk/extensions/Contest/specials/SpecialContestSignup.php
===================================================================
--- trunk/extensions/Contest/specials/SpecialContestSignup.php 2011-10-12
17:46:28 UTC (rev 99640)
+++ trunk/extensions/Contest/specials/SpecialContestSignup.php 2011-10-12
17:53:54 UTC (rev 99641)
@@ -51,9 +51,7 @@
* @return false|boolean
*/
public function isListed() {
-
return false;
-
}
/**
Modified: trunk/extensions/Contest/specials/SpecialContests.php
===================================================================
--- trunk/extensions/Contest/specials/SpecialContests.php 2011-10-12
17:46:28 UTC (rev 99640)
+++ trunk/extensions/Contest/specials/SpecialContests.php 2011-10-12
17:53:54 UTC (rev 99641)
@@ -23,6 +23,28 @@
}
/**
+ * Returns if the user can access the page or not.
+ *
+ * @return boolean
+ */
+ protected function userCanAccess() {
+ $user = $this->getUser();
+ return
+ ( $user->isAllowed( 'contestadmin' ) ||
$user->isAllowed( 'contestjudge' ) )
+ && !$user->isBlocked();
+ }
+
+ /**
+ * This page is unlisted because the only way to access it is though a
contest
+ * landing page.
+ *
+ * @return false|boolean
+ */
+ public function isListed() {
+ return $this->userCanAccess();
+ }
+
+ /**
* Main method.
*
* @since 0.1
@@ -38,8 +60,7 @@
$user = $this->getUser();
- if ( !$user->isAllowed( 'contestadmin' ) || !$user->isAllowed(
'contestjudge' ) || $user->isBlocked() ) {
- // TODO: does this work property?
+ if ( !$this->userCanAccess() ) {
$this->displayRestrictionError();
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs