示例#1
0
文件: Acl.php 项目: psesd/sensor-hub
 /**
  * @inheritdoc
  */
 public function run()
 {
     if (!User::systemUser()) {
         return false;
     }
     return parent::run();
 }
示例#2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $user = new User();
     $user->scenario = 'creation';
     $user->attributes = $this->input['admin'];
     $user->status = User::STATUS_ACTIVE;
     $superGroup = Group::find()->disableAccessCheck()->where(['system' => 'super_administrators'])->one();
     if (!$superGroup) {
         throw new Exception("Unable to find super_administrators group!");
     }
     $user->relationModels = [['parent_object_id' => $superGroup->primaryKey]];
     if ($user->save()) {
         return true;
     }
     foreach ($user->errors as $field => $errors) {
         $this->fieldErrors[$field] = implode('; ', $errors);
     }
     var_dump($this->fieldErrors);
     exit;
     return false;
 }