-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathYii2DbRbac.php
46 lines (40 loc) · 1.09 KB
/
Yii2DbRbac.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
/**
* Yii2DbRbac for Yii2
*
* @author Elle <[email protected]>
* @version 1.1
* @package Yii2DbRbac for Yii2
*
*/
namespace developeruz\db_rbac;
use Yii;
class Yii2DbRbac extends \yii\base\Module
{
public $controllerNamespace = 'developeruz\db_rbac\controllers';
public $theme = false;
public $userClass;
public $accessRoles;
public function init()
{
parent::init();
$this->registerTranslations();
if ($this->theme) {
Yii::$app->view->theme = new \yii\base\Theme($this->theme);
}
}
public function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['db_rbac'])) {
Yii::$app->i18n->translations['db_rbac'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'ru-Ru',
'basePath' => '@developeruz/db_rbac/messages',
];
}
}
public static function t($category, $message, $params = [], $language = null)
{
return Yii::t('modules/db_rbac/' . $category, $message, $params, $language);
}
}