Index: trunk/extensions/SemanticACL/SemanticACL.php |
— | — | @@ -81,40 +81,33 @@ |
82 | 82 | $result = false; |
83 | 83 | return false; |
84 | 84 | } |
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; |
88 | 87 | |
89 | | - $inWhitelistedGroup = false; |
| 88 | + $groupProperty = new SMWDIProperty( "{$prefix}_WL_GROUP" ); |
| 89 | + $userProperty = new SMWDIProperty( "{$prefix}_WL_USER" ); |
| 90 | + $whitelistValues = $store->getPropertyValues( $subject, $groupProperty ); |
90 | 91 | |
91 | 92 | foreach( $whitelistValues as $whitelistValue ) { |
92 | 93 | $group = strtolower($whitelistValue->getString()); |
93 | 94 | |
94 | 95 | if ( in_array( $group, $user->getEffectiveGroups() ) ) { |
95 | | - $inWhitelistedGroup = true; |
| 96 | + $isWhitelisted = true; |
96 | 97 | break; |
97 | 98 | } |
98 | 99 | } |
99 | 100 | |
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 ); |
107 | 102 | |
108 | | - $isWhitelistedUser = false; |
109 | | - |
110 | 103 | foreach( $whitelistValues as $whitelistValue ) { |
111 | 104 | $title = $whitelistValue->getTitle(); |
112 | 105 | |
113 | 106 | if ( $title->equals( $user->getUserPage() ) ) { |
114 | | - $isWhitelistedUser = true; |
| 107 | + $isWhitelisted = true; |
115 | 108 | } |
116 | 109 | } |
117 | 110 | |
118 | | - if ( ! $isWhitelistedUser ) { |
| 111 | + if ( ! $isWhitelisted ) { |
119 | 112 | $result = false; |
120 | 113 | return false; |
121 | 114 | } |