public function actionAdmin() { $this->layout = Yum::module()->adminLayout; $model = new YumAction('search'); $model->unsetAttributes(); if (isset($_GET['YumAction'])) { $model->attributes = $_GET['YumAction']; } $this->render('admin', array('model' => $model)); }
public function actionAdmin() { $this->layout = Yum::module('role')->layout; $model = new YumPermission('search'); $model->unsetAttributes(); if (isset($_GET['YumPermission'])) { $model->attributes = $_GET['YumPermission']; } $this->render('admin', array('model' => $model, 'rolefilter' => CHtml::listData(YumRole::model()->findAll(), 'id', 'title'), 'actionfilter' => CHtml::listData(YumAction::model()->findAll(), 'id', 'title'))); }
public function actionIndex() { $this->render('view', array('actions' => YumAction::model()->findAll())); }
public function getPermissions($subaction = null) { if (!Yum::hasModule('role') || !$this->id) { return array(); } Yii::import('user.role.models.*'); $roles = $this->roles; if (Yum::hasModule('membership')) { $roles = array_merge($roles, $this->getActiveMemberships()); } $role_ids = array(); foreach ($roles as $role) { $role_ids[] = $role->id; } $cmd = Yii::app()->db->createCommand()->select('id, action.title')->from('permission')->join('action', 'action.id = permission.action')->where(array('and', "type = 'role'", array('in', 'principal_id', $role_ids))); // If a subaction is given, we filter by subaction if ($subaction) { $subaction_id = YumAction::model()->findByAttributes(array('title' => $subaction)); if ($subaction_id) { $subaction_id = $subaction_id->id; } $cmd->where(array('and', "type = 'role'", "permission.subaction = '{$subaction_id}'", array('in', 'principal_id', $role_ids))); } return $cmd->queryAll(); }