-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
46 lines (37 loc) · 1.02 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace humanized\rbac;
/**
*
* @name Yii2 RBAC Module Class
* @version 0.1
* @author Jeffrey Geyssens <jeffrey@humanized.be>
* @package yii2-rbac
*/
class Module extends \yii\base\Module {
public $identityClass = NULL;
public $fnUser = NULL;
public function init()
{
parent::init();
if (\Yii::$app instanceof \yii\console\Application) {
$this->controllerNamespace = 'humanized\rbac\commands';
}
$this->initIdentityModel();
}
/**
*
*/
private function initIdentityModel()
{
//Setting Default Identity class
if (!isset($this->identityClass)) {
$this->identityClass = \Yii::$app->user->identityClass;
}
//Setting static finder method defined by the identity class
if (!isset($this->fnUser)) {
$this->fnUser = "findByUsername";
}
$this->params['identityClass'] = $this->identityClass;
$this->params['fnUser'] = $this->fnUser;
}
}