Skip to content
This repository has been archived by the owner on Feb 20, 2018. It is now read-only.

Commit

Permalink
Fix an error of flawed logic in user.php fixes #40
Browse files Browse the repository at this point in the history
If $this->roles is empty, either no roles where assigned, or all assigned roles were removed.

Only in that case, the code should look into a default value. 

The OR part in the if statement should not be there.
  • Loading branch information
dre1080 committed Dec 20, 2013
1 parent 6c3ba86 commit 576aefd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/warden/model/user.php
Expand Up @@ -964,7 +964,7 @@ private function _ensure_and_validate_password()
private function _add_default_role()
{
// Make sure no roles exist already
if (empty($this->roles) || !static::query()->related('roles')->get_one()) {
if (empty($this->roles)) {
// Check for default role
if (($default_role = \Config::get('warden.default_role'))) {
$role = \Model_Role::find('first', array(
Expand Down

0 comments on commit 576aefd

Please sign in to comment.