r88710 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88709‎ | r88710 | r88711 >
Date:02:14, 24 May 2011
Author:werdna
Status:deferred
Tags:
Comment:
Merge whitelist options
Modified paths:
  • /trunk/extensions/SemanticACL/SemanticACL.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticACL/SemanticACL.php
@@ -81,40 +81,33 @@
8282 $result = false;
8383 return false;
8484 }
85 - } elseif ( $value == 'whitelist group' ) {
86 - $whitelistProperty = new SMWDIProperty( "{$prefix}_WL_GROUP" );
87 - $whitelistValues = $store->getPropertyValues( $subject, $whitelistProperty );
 85+ } elseif ( $value == 'whitelist' ) {
 86+ $isWhitelisted = false;
8887
89 - $inWhitelistedGroup = false;
 88+ $groupProperty = new SMWDIProperty( "{$prefix}_WL_GROUP" );
 89+ $userProperty = new SMWDIProperty( "{$prefix}_WL_USER" );
 90+ $whitelistValues = $store->getPropertyValues( $subject, $groupProperty );
9091
9192 foreach( $whitelistValues as $whitelistValue ) {
9293 $group = strtolower($whitelistValue->getString());
9394
9495 if ( in_array( $group, $user->getEffectiveGroups() ) ) {
95 - $inWhitelistedGroup = true;
 96+ $isWhitelisted = true;
9697 break;
9798 }
9899 }
99100
100 - if ( ! $inWhitelistedGroup ) {
101 - $result = false;
102 - return false;
103 - }
104 - } elseif ( $value == 'whitelist user' ) {
105 - $whitelistProperty = new SMWDIProperty( "{$prefix}_WL_USER" );
106 - $whitelistValues = $store->getPropertyValues( $subject, $whitelistProperty );
 101+ $whitelistValues = $store->getPropertyValues( $subject, $userProperty );
107102
108 - $isWhitelistedUser = false;
109 -
110103 foreach( $whitelistValues as $whitelistValue ) {
111104 $title = $whitelistValue->getTitle();
112105
113106 if ( $title->equals( $user->getUserPage() ) ) {
114 - $isWhitelistedUser = true;
 107+ $isWhitelisted = true;
115108 }
116109 }
117110
118 - if ( ! $isWhitelistedUser ) {
 111+ if ( ! $isWhitelisted ) {
119112 $result = false;
120113 return false;
121114 }

Status & tagging log