| 1 | <?php |
||
| 18 | class AuthItemFactory |
||
| 19 | { |
||
| 20 | protected static $map = [ |
||
| 21 | Item::TYPE_ROLE => 'makeRole', |
||
| 22 | Item::TYPE_PERMISSION => 'makePermission', |
||
| 23 | ]; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param $name |
||
| 27 | * |
||
| 28 | * @return \yii\rbac\Permission |
||
| 29 | */ |
||
| 30 | public static function makePermission($name) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param $name |
||
| 37 | * |
||
| 38 | * @return \yii\rbac\Role |
||
| 39 | */ |
||
| 40 | public static function makeRole($name) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param $type |
||
| 47 | * @param $name |
||
| 48 | * |
||
| 49 | * @throws Exception |
||
| 50 | * @return \yii\rbac\Role|\yii\rbac\Permission |
||
| 51 | * |
||
| 52 | */ |
||
| 53 | public static function makeByType($type, $name) |
||
| 61 | } |
||
| 62 |