Commit be6b259c by Qiang Xue

A better fix.

parent 993339f0
...@@ -495,11 +495,10 @@ abstract class Application extends Module ...@@ -495,11 +495,10 @@ abstract class Application extends Module
/** /**
* Returns the auth manager for this application. * Returns the auth manager for this application.
* @return \yii\rbac\Manager the auth manager for this application. * @return \yii\rbac\Manager the auth manager for this application.
* Null will be returned if "authManager" is not installed.
*/ */
public function getAuthManager() public function getAuthManager()
{ {
return $this->get('authManager', false); return $this->get('authManager');
} }
/** /**
......
...@@ -137,10 +137,14 @@ class AccessRule extends Component ...@@ -137,10 +137,14 @@ class AccessRule extends Component
return true; return true;
} }
foreach ($this->roles as $role) { foreach ($this->roles as $role) {
if ($role === '?' && $user->getIsGuest()) { if ($role === '?') {
return true; if ($user->getIsGuest()) {
} elseif ($role === '@' && !$user->getIsGuest()) { return true;
return true; }
} elseif ($role === '@') {
if (!$user->getIsGuest()) {
return true;
}
} elseif ($user->checkAccess($role)) { } elseif ($user->checkAccess($role)) {
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment