Tareas #1124 -> Un agente puede modificar la empresa si sabe la URL de modificación

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@52 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
David Arranz 2012-10-02 19:50:45 +00:00
parent 3df8ebee09
commit 37307e14cf
4 changed files with 34 additions and 7 deletions

View File

@ -20,9 +20,10 @@ class EmpresaController extends Controller {
*/
public function accessRules() {
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
array('allow',
'actions' => array('modificar'),
'users' => array('@'),
'expression' => 'Yii::app()->user->esCoordinador',
),
array('deny', // deny all users
'users' => array('*'),

View File

@ -18,9 +18,10 @@ class EquipoController extends Controller {
*/
public function accessRules() {
return array(
array('allow', // allow admin user to perform 'admin' and 'delete' actions
array('allow',
'actions' => array('index', 'delete'),
'users' => array('@'),
'expression' => 'Yii::app()->user->esCoordinador',
),
array('deny', // deny all users
'users' => array('*'),

View File

@ -9,10 +9,11 @@ class SiteController extends Controller {
public function accessRules() {
return array(
array('allow',
'actions' => array('login', 'callback'),
'actions' => array('login', 'callback', 'error'),
'users' => array('*')
),
array('allow',
'actions' => array('logout'),
'users' => array('@')
),
array('deny'),
@ -89,7 +90,7 @@ class SiteController extends Controller {
*/
public function actionLogout() {
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
$this->redirect(Yii::app()->params['frontpage']);
}
public function actionCallback() {

View File

@ -2,13 +2,37 @@
class SubscripcionController 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',
'actions' => array('modificar'),
'users' => array('@'),
'expression' => 'Yii::app()->user->esCoordinador',
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
public function actionModificar($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Subscripcion'])) {
$model->attributes = $_POST['Subscripcion'];