Ejemplo n.º 1
0
 /**
  * @name 权限项入库
  * 第二次时,应该查数据库中是否存在此项,
  * 如果存在,则直接更新部分字段
  */
 public function actionSync()
 {
     if (Permission::sync()) {
         return $this->ajaxReturn(null, null, 1);
     } else {
         return $this->ajaxReturn(null, '初始化权限失败');
     }
 }
Ejemplo n.º 2
0
 protected function populateItem($row)
 {
     $class = $row['type'] == Item::TYPE_PERMISSION ? Permission::className() : Role::className();
     if (!isset($row['data']) || ($data = @unserialize($row['data'])) === false) {
         $data = null;
     }
     return new $class(['name' => $row['name'], 'type' => $row['type'], 'description' => $row['description'], 'real_title' => $row['real_title'], 'ruleName' => $row['rule_name'], 'data' => $data, 'createdAt' => $row['created_at'], 'updatedAt' => $row['updated_at']]);
 }
Ejemplo n.º 3
0
 /**
  * @name 化分权限
  */
 public function actionPermission($id)
 {
     $model = $this->auth->getRole($id);
     return $this->render('permission', ['classes' => Permission::getShowFormat($id), 'model' => $model]);
 }