Visibility not correctly saved on space creation

This commit is contained in:
Lucas Bartholemy 2014-09-24 06:48:11 +02:00
parent ad4a03e88a
commit 03cb7d5646

View File

@ -10,6 +10,33 @@
class CreateController extends Controller
{
/**
* @return array action filters
*/
public function filters()
{
return array(
'accessControl', // perform access control for CRUD operations
);
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules()
{
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'users' => array('@'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
public function actionIndex()
{
$this->redirect($this->createUrl('create/create'));
@ -38,12 +65,6 @@ class CreateController extends Controller
$model->attributes = $_POST['Space'];
if (Yii::app()->user->canCreatePublicSpace()) {
$model->visibility = Space::VISIBILITY_ALL;
} else {
$model->visibility = Space::VISIBILITY_NONE;
}
if ($model->validate() && $model->save()) {
// Save in this user variable, that the workspace was new created
@ -52,7 +73,6 @@ class CreateController extends Controller
// Redirect to the new created Space
$this->htmlRedirect($model->getUrl());
}
}
$this->renderPartial('create', array('model' => $model), false, true);