Skip to content

Commit

Permalink
set files paths in class
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Sep 27, 2016
1 parent 78852f3 commit dce698a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
38 changes: 37 additions & 1 deletion src/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@
use yii\rbac\Item;

/**
* AuthManager class.
* HiPanel AuthManager.
*
* @author Andrii Vasyliev <sol@hiqdev.com>
*/
class AuthManager extends \yii\rbac\PhpManager
{

public $itemFile = '@hipanel/rbac/files/items.php';
public $ruleFile = '@hipanel/rbac/files/rules.php';
public $assignmentFile = '@hipanel/rbac/files/assignments.php';

/**
* Set permission.
* @param string $name
Expand Down Expand Up @@ -122,4 +127,35 @@ public function setAssignment($role, $userId)
}
return $this->assign($role, $userId);
}

public function getRoles()
{
return $this->getItems(Item::TYPE_ROLE);
}

public function getPermissions()
{
return $this->getItems(Item::TYPE_PERMISSION);
}

public function getAllAssignments()
{
return $this->assignments;
}

/**
* We don't keep all the assignments, only basic.
* @see forceSaveAssignments
*/
protected function saveAssignments()
{
}

/**
* Create only basic assignments before saving.
*/
public function saveBasicAssignments()
{
parent::saveAssignments();
}
}
4 changes: 0 additions & 4 deletions src/config/hidev.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
'class' => \hipanel\rbac\console\RbacController::class,
],
],
/// TODO move to common
'authManager' => [
'class' => \hipanel\rbac\AuthManager::class,
'itemFile' => '@root/rbac/items.php',
'ruleFile' => '@root/rbac/rules.php',
'assignmentFile' => '@root/rbac/assignments.php',
],
],
];

0 comments on commit dce698a

Please sign in to comment.