Beispiel #1
0
 public function actionPermissions($id)
 {
     //$model=  DatabasesPerm::model()->findByPk($id);
     $model = new DatabasesPerm('search');
     $model->unsetAttributes();
     // clear any default values
     $model->database_id = $id;
     $user = new DatabasesPerm();
     $user->database_id = $id;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['DatabasesPerm'])) {
         $user->attributes = $_POST['DatabasesPerm'];
         $user->save();
         //if($model->save())
         //    $this->redirect(array('index'));
     }
     $this->render('permissions', array('model' => $model, 'user' => $user));
 }
Beispiel #2
0
 /**
  * @return string the associated database table name
  */
 public function getLevel()
 {
     $level = DatabasesPerm::model()->findByPk(array($this->id, Yii::app()->user->id));
     return $level;
 }