Beispiel #1
0
 public function actionIndex()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->load($_POST)) {
         if ($model->login()) {
             return $this->goHome();
         }
     }
     return $this->render('index', array('model' => $model, 'federation' => AaaPreference::isFederationEnabled()));
 }
 public function save()
 {
     $pref = AaaPreference::findOne(AaaPreference::AAA_FEDERATION_GROUP);
     $pref->value = $this->group;
     if (!$pref->save()) {
         return false;
     }
     $pref = AaaPreference::findOne(AaaPreference::AAA_FEDERATION_DOMAIN);
     $pref->value = $this->domain;
     if (!$pref->save()) {
         return false;
     }
     $pref = AaaPreference::findOne(AaaPreference::AAA_FEDERATION_ENABLED);
     $pref->value = $this->status;
     if (!$pref->save()) {
         return false;
     }
     return true;
 }
 public function actionIndex()
 {
     if (!self::can('group/update')) {
         return $this->goHome();
     }
     $config = new ConfigurationForm();
     $config->setPreferences(AaaPreference::findAll());
     if ($config->load($_POST)) {
         if (!self::can('configuration/update')) {
             Yii::$app->getSession()->addFlash("warning", Yii::t("circuits", "You don`t allowed to update the configurations"));
             return $this->render('config', array('model' => $config));
         }
         if ($config->validate() && $config->save()) {
             Yii::$app->getSession()->addFlash("success", Yii::t("circuits", "Configurations saved successfully"));
         } else {
             foreach ($config->getErrors() as $attribute => $error) {
                 Yii::$app->getSession()->addFlash("error", $error[0]);
             }
             $config->clearErrors();
         }
     }
     return $this->render('index', array('model' => $config));
 }