/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new User(); $profile = new Profile(); if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password); $model->createtime = time(); $model->lastvisit = time(); $profile->attributes = $_POST['Profile']; $profile->user_id = 0; if ($model->validate() && $profile->validate()) { $model->password = Yii::app()->controller->module->encrypting($model->password); if ($model->save()) { $profile->user_id = $model->id; $profile->save(); // assign user the 'Authenticated' role for Rights module $authenticatedName = Rights::module()->authenticatedName; Rights::assign($authenticatedName, $model->id); // end of change } $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'profile' => $profile)); }
/** * Constructor. * (e.g. <code>Post::model()</code>, <code>Post::model()->published()</code>). * @param array $config configuration (name=>value) to be applied as the initial property values of this class. */ public function __construct($config = array()) { $module = Rights::module(); $userClass = $module->userClass; parent::__construct($userClass, $config); $this->_authorizer = $module->getAuthorizer(); }
public function getType() { if ($this->typeColumn === null) { $this->typeColumn = Rights::module()->userTypeColumn; } return $this->owner->{$this->typeColumn}; }
/** * Returns the value of the owner's name column. * Attribute name is retrived from the module configuration. * @return string the name. */ public function getName() { if ($this->nameColumn === null) { $this->nameColumn = Rights::module()->userNameColumn; } return $this->owner->{$this->nameColumn}; }
/** * Registration user */ public function actionRegistration() { $model = new RegistrationForm(); $profile = new Profile(); $profile->regMode = true; if (Yii::app()->user->id) { $this->redirect(Yii::app()->controller->module->profileUrl); } else { if (isset($_POST['RegistrationForm'])) { $model->attributes = $_POST['RegistrationForm']; $profile->attributes = $_POST['Profile']; if ($model->validate() && $profile->validate()) { $soucePassword = $model->password; $model->activkey = UserModule::encrypting(microtime() . $model->password); $model->password = UserModule::encrypting($model->password); $model->verifyPassword = UserModule::encrypting($model->verifyPassword); $model->createtime = time(); $model->lastvisit = (Yii::app()->controller->module->loginNotActiv || Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail == false) && Yii::app()->controller->module->autoLogin ? time() : 0; $model->superuser = 0; $model->status = Yii::app()->controller->module->activeAfterRegister ? User::STATUS_ACTIVE : User::STATUS_NOACTIVE; if ($model->save()) { $profile->user_id = $model->id; $profile->save(); // assign user the 'Authenticated' role for Rights module $authenticatedName = Rights::module()->authenticatedName; Rights::assign($authenticatedName, $model->id); // end of change if (Yii::app()->controller->module->sendActivationMail) { $activation_url = 'http://' . $_SERVER['HTTP_HOST'] . $this->createUrl('/user/activation/activation', array("activkey" => $model->activkey, "email" => $model->email)); UserModule::sendMail($model->email, UserModule::t("You have registered at {site_name}", array('{site_name}' => Yii::app()->name)), UserModule::t("Please activate your account. Go to {activation_url}", array('{activation_url}' => $activation_url))); } if ((Yii::app()->controller->module->loginNotActiv || Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail == false) && Yii::app()->controller->module->autoLogin) { $identity = new UserIdentity($model->username, $soucePassword); $identity->authenticate(); Yii::app()->user->login($identity, 0); $this->redirect(Yii::app()->controller->module->returnUrl); } else { if (!Yii::app()->controller->module->activeAfterRegister && !Yii::app()->controller->module->sendActivationMail) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for registering. Contact Admin to activate your account.")); } elseif (Yii::app()->controller->module->activeAfterRegister && Yii::app()->controller->module->sendActivationMail == false) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for registering. Please {{login}}.", array('{{login}}' => CHtml::link(UserModule::t('Login'), Yii::app()->controller->module->loginUrl)))); } elseif (Yii::app()->controller->module->loginNotActiv) { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for registering. Please check your email or login.")); } else { Yii::app()->user->setFlash('registration', UserModule::t("Thank you for registering. Please check your email.")); } $this->refresh(); } } } } $this->render('/user/registration', array('form' => $model, 'profile' => $profile)); } }
<style>.pagination{margin:0}</style> <section class="panel"> <header class="panel-heading"> <?php echo Rights::t('core', 'Quản lý hoạt động'); ?> <?php echo CHtml::link(Rights::t('core', 'Create a new operation'), array('authItem/create', 'type' => CAuthItem::TYPE_OPERATION), array('class' => 'add-operation-link btn btn-default')); ?> </header> <div class="panel-body"> <div class="adv-table"> <div class="alert alert-warning fade in" style="margin-bottom: 0;"> <?php echo Rights::t('core', 'An operation is a permission to perform a single operation, for example accessing a certain controller action.'); ?> <br /> <?php echo Rights::t('core', 'Operations exist below tasks in the authorization hierarchy and can therefore only inherit from other operations.'); ?> </div> <?php $this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => $dataProvider, 'template' => '{items}', 'emptyText' => Rights::t('core', 'No operations found.'), 'htmlOptions' => array('class' => 'grid-view operation-table sortable-table'), 'itemsCssClass' => 'table-default items table table-striped table-bordered', 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getGridNameLink()'), array('name' => 'description', 'header' => Rights::t('core', 'Description'), 'type' => 'raw', 'htmlOptions' => array('class' => 'description-column')), array('name' => 'bizRule', 'header' => Rights::t('core', 'Business rule'), 'type' => 'raw', 'htmlOptions' => array('class' => 'bizrule-column'), 'visible' => Rights::module()->enableBizRule === true), array('name' => 'data', 'header' => Rights::t('core', 'Data'), 'type' => 'raw', 'htmlOptions' => array('class' => 'data-column'), 'visible' => Rights::module()->enableBizRuleData === true), array('header' => ' ', 'type' => 'raw', 'htmlOptions' => array('class' => 'actions-column'), 'value' => '$data->getDeleteOperationLink()')))); ?> </div> <p class="info"><?php echo Rights::t('core', 'Values within square brackets tell how many children each item has.'); ?> </p> </div> </section>
?> <?php echo $form->error($model, 'bizRule'); ?> <p class="hint"><?php echo Rights::t('core', 'Code that will be executed when performing access checking.'); ?> </p> </div> <?php } ?> <?php if (Rights::module()->enableBizRule === true && Rights::module()->enableBizRuleData) { ?> <div class="row"> <?php echo $form->labelEx($model, 'data'); ?> <?php echo $form->textField($model, 'data', array('maxlength' => 255, 'class' => 'text-field')); ?> <?php echo $form->error($model, 'data'); ?> <p class="hint"><?php echo Rights::t('core', 'Additional data available when executing the business rule.'); ?>
public static function displayMenu() { return array('cssFile' => '', 'items' => array(array('label' => 'Home', 'url' => array('/home'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Customer', 'url' => array('/customer/admin'), 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'List Customer', 'url' => array('/customer/admin')), array('label' => 'Add Customer', 'url' => array('/customer/create')))), array('label' => 'Billing', 'url' => array('/invoices/customerList'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Shipment', 'url' => array('/shipment/customerService'), 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'Cek Rate', 'url' => array('/shipment/cekRate')), array('label' => 'Create Order', 'url' => array('/shipment/createAWB')), array('label' => 'Tracing', 'url' => '#'))), array('label' => 'Operation', 'url' => array('/booking'), 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'Courier', 'url' => array('/driver/index')), array('label' => 'Data Entry', 'url' => array('/shipment/createAWB')), array('label' => 'Bulk Data Entry', 'url' => array('/shipment/entryBulkOrder')), array('label' => 'Bulk Update Status', 'url' => array('/ordertracking/updateBulkStatus')))), array('label' => 'Admin', 'url' => '#', 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'Carrier', 'url' => array('/rateCompany'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Product', 'url' => array('/product')))), array('label' => 'Report', 'url' => array('/report'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'System', 'url' => '#', 'visible' => Yii::app()->user->checkAccess(Rights::module()->superuserName), 'items' => array(array('label' => 'User', 'url' => array('/user/index'), 'visible' => !Yii::app()->user->isGuest, 'items' => array(array('label' => 'List User', 'url' => array('/user/index')), array('label' => 'Add User', 'url' => array('/user/create')))), array('label' => 'RBAC Manager', 'url' => array('/rights'), 'visible' => Yii::app()->user->checkAccess(Rights::module()->superuserName)))))); }
/** * Returns the markup for the assign permission link. * @param CAuthItem $role the role the permission is for. * @return string the markup. */ public function getAssignPermissionLink(CAuthItem $role) { $this->parent = $role; $app = Yii::app(); $baseUrl = Rights::module()->baseUrl . '/'; $csrf = ($csrf = $this->getCsrfValidationParam()) !== null ? ', ' . $csrf : ''; $onclick = <<<EOD jQuery.ajax({ \ttype:'POST', \turl:'{$app->createUrl($baseUrl . 'authItem/assign', array('name' => $this->parent->name, 'child' => $this->owner->name))}', \tdata:{ \t\tajax:1 \t\t{$csrf} \t}, \tsuccess:function() { \t\t\$("#permissions").load('{$app->createUrl($baseUrl . 'authItem/permissions')}', { \t\t\tajax:1 \t\t\t{$csrf} \t\t}); \t} }); return false; EOD; return CHtml::link(Rights::t('core', 'Assign'), '#', array('onclick' => $onclick, 'class' => 'assign-link')); }
<?php $this->beginContent(Rights::module()->appLayout); ?> <div id="rights" class="container"> <div id="content"> <?php if ($this->id !== 'install') { ?> <div id="menu"> <?php $this->renderPartial('/_menu'); ?> </div> <?php } ?> <?php $this->renderPartial('/_flash'); ?> <?php echo $content; ?>
<h2><?php echo Rights::t('core', 'Operations'); ?> </h2> <p> <?php echo Rights::t('core', 'An operation is a permission to perform a single operation, for example accessing a certain controller action.'); ?> <br /> <?php echo Rights::t('core', 'Operations exist below tasks in the authorization hierarchy and can therefore only inherit from other operations.'); ?> </p> <p><?php echo CHtml::link(Rights::t('core', 'Create a new operation'), array('authItem/create', 'type' => CAuthItem::TYPE_OPERATION), array('class' => 'add-operation-link')); ?> </p> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'template' => '{items}', 'emptyText' => Rights::t('core', 'No operations found.'), 'htmlOptions' => array('class' => 'grid-view operation-table sortable-table'), 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getNameLink(false, true, true)'), array('name' => 'description', 'header' => Rights::t('core', 'Description'), 'type' => 'raw', 'htmlOptions' => array('class' => 'description-column')), array('name' => 'bizRule', 'header' => Rights::t('core', 'Business rule'), 'type' => 'raw', 'htmlOptions' => array('class' => 'bizrule-column'), 'visible' => Rights::module()->enableBizRule === true), array('name' => 'data', 'header' => Rights::t('core', 'Data'), 'type' => 'raw', 'htmlOptions' => array('class' => 'data-column'), 'visible' => Rights::module()->enableBizRuleData === true), array('header' => ' ', 'type' => 'raw', 'htmlOptions' => array('class' => 'actions-column'), 'value' => '$data->getDeleteOperationLink()')))); ?> <p class="info"><?php echo Rights::t('core', 'Values within square brackets tell how many children each item has.'); ?> </p> </div>
/** * Attaches the rights user behavior to the given users. * @param mixed $users the user or users to which attach the behavior. * @return mixed the user or users with the behavior attached. */ public function attachUserBehavior($users) { $userClass = Rights::module()->userClass; // We have a single user. if ($users instanceof $userClass) { $users->attachBehavior('rights', new RUserBehavior()); } else { if ($users === (array) $users) { foreach ($users as $user) { $user->attachBehavior('rights', new RUserBehavior()); } } } return $users; }
/** * Makes sure that the superuser roles name is not changed. * This is the 'isSuperuser' validator as declared in rules(). */ public function isSuperuser($attribute, $params) { if (strtolower($_GET['name']) !== strtolower($this->name) && strtolower($_GET['name']) === strtolower(Rights::module()->superuserName)) { $this->addError('name', Rights::t('core', 'Name of the superuser cannot be changed.')); } }
?> </h2> <?php $this->renderPartial('_form', array('model' => $formModel)); ?> <div class="relations span-11 last"> <h3><?php echo Rights::t('core', 'Relations'); ?> </h3> <?php if ($model->name !== Rights::module()->superuserName) { ?> <div class="parents"> <h4><?php echo Rights::t('core', 'Parents'); ?> </h4> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $parentDataProvider, 'template' => '{items}', 'hideHeader' => true, 'emptyText' => Rights::t('core', 'This item has no parents.'), 'htmlOptions' => array('class' => 'grid-view parent-table mini'), 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getNameLink()'), array('name' => 'type', 'header' => Rights::t('core', 'Type'), 'type' => 'raw', 'htmlOptions' => array('class' => 'type-column'), 'value' => '$data->getTypeText()'), array('header' => ' ', 'type' => 'raw', 'htmlOptions' => array('class' => 'actions-column'), 'value' => '')))); ?> </div>
?> </h3> <p> <code> <?php echo Rights::t('core', 'Vai trò là một nhóm quyền để thực hiện hàng loạt các thao tác(operations) và chỉ định(task).'); ?> <?php echo Rights::t('core', 'Vai trò nằm ở mức cao nhất của hệ thống phân cấp ủy quyền và do đó có thể kế thừa từ quyền quản trị, thao tác(operations) hoặc chỉ định(task) khác.'); ?> </code> </p> <p class="btn btn-xs alert-warning"> <?php echo CHtml::link(Rights::t('core', '<i class="fa fa-plus-circle"></i> Tạo thêm vai trò'), array('authItem/create', 'type' => CAuthItem::TYPE_ROLE), array('class' => 'add-role-link')); ?> </p> <div class="well"> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'id' => 'webmaster-grid', 'itemsCssClass' => 'table table-bordered table-condensed text-center', 'summaryText' => 'Hiển thị {start} <i class="fa fa-long-arrow-right"></i> {end} của {count} kết quả', 'pager' => array('class' => 'CLinkPager', 'header' => '', 'prevPageLabel' => '<i class="fa fa-angle-left"></i>', 'nextPageLabel' => '<i class="fa fa-angle-right"></i>', 'firstPageLabel' => '<i class="fa fa-angle-double-left"></i>', 'lastPageLabel' => '<i class="fa fa-angle-double-right"></i>', 'maxButtonCount' => 5, 'firstPageCssClass' => '', 'lastPageCssClass' => '', 'previousPageCssClass' => '', 'nextPageCssClass' => '', 'internalPageCssClass' => '', 'selectedPageCssClass' => 'select_page', 'hiddenPageCssClass' => 'hidden_page', 'htmlOptions' => array('class' => '', 'style' => '', 'id' => '')), 'emptyText' => Rights::t('core', 'Vai trò không tồn tại'), 'htmlOptions' => array('class' => 'grid-view role-table'), 'columns' => array(array('header' => 'STT', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'name', 'header' => Rights::t('core', 'Tên vai trò'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getGridNameLink()'), array('name' => 'description', 'header' => Rights::t('core', 'Mô tả'), 'type' => 'raw', 'htmlOptions' => array('class' => 'description-column')), array('name' => 'bizRule', 'header' => Rights::t('core', 'Quy luật Business'), 'type' => 'raw', 'htmlOptions' => array('class' => 'bizrule-column'), 'visible' => Rights::module()->enableBizRule === true), array('name' => 'data', 'header' => Rights::t('core', 'Data'), 'type' => 'raw', 'htmlOptions' => array('class' => 'data-column'), 'visible' => Rights::module()->enableBizRuleData === true), array('header' => ' ', 'type' => 'raw', 'htmlOptions' => array('class' => 'actions-column'), 'value' => '$data->getDeleteRoleLink()')))); ?> <p class="info"><?php echo Rights::t('core', '<i class="text-info">Giá trị trong dấu ngoặc vuông cho biết có bao nhiêu quyền được tạo</i>'); ?> </p> </div> </div>
/** * Returns the markup for the delete role link. * @return string the markup. */ public function getDeleteRoleLink() { // We do not want to show the delete link for the superuser role. if ($this->owner->name !== Rights::module()->superuserName) { return CHtml::linkButton(Rights::t('core', ''), array('submit' => array('authItem/delete', 'name' => urlencode($this->owner->name)), 'confirm' => Rights::t('core', 'Are you sure you want to delete this role?'), 'class' => 'fa fa-trash', 'title' => 'Eliminar', 'csrf' => Yii::app()->request->enableCsrfValidation)); } }
/js/bootstrap.js"></script> </head> <body> <div class="navbar navbar-fixed-top"> <div class="navbar-inner" > <div class="" > <div class="subnavbar"> <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span> </a><a href="/presupuestosv2/index.php?r=rights" class="brand"><img id="img-logo" src="<?php echo Yii::app()->theme->baseUrl; ?> /img/fin.png"/><span id="logo-title"></span></a> <div style="visibility: hidden"> <?php if (Yii::app()->user->checkAccess(Rights::module()->superuserName)) { //if (Yii::app()->user->checkAccess(Rights::module()->superuserName)=="Control") { ?> </div> <div class="subnavbar-inner"> <div class="container"> <ul class="mainnav"> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=rights"><i class="fa fa-dashboard"></i><span>Dashboard</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/usuarios/admin"><i class="fa fa-user"></i><span>Usuarios</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/tipoCosto/admin"><i class="fa fa-money "></i><span>Tipos de Costo</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/proyecto/admin"><i class="fa fa-bar-chart-o "></i><span>Proyectos</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/indicadorCosto/admin"><i class="fa fa-file "></i><span>Indicador Costo</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/costo/admin"><i class="fa fa-file "></i><span>Costo</span> </a> </li> <li class="subnavbar-open-right"><a href="/presupuestosv2/index.php?r=Control/actividad/admin"><i class="fa fa-file "></i><span>Actividades</span> </a> </li>
<p> <?php echo Rights::t('core', 'A role is group of permissions to perform a variety of tasks and operations, for example the authenticated user.'); ?> <br /> <?php echo Rights::t('core', 'Roles exist at the top of the authorization hierarchy and can therefore inherit from other roles, tasks and/or operations.'); ?> </p> <p> <i class="fa fa-plus-circle text-info"></i> <?php echo CHtml::link(Rights::t('core', 'Crear Nuevo Perfil'), array('authItem/create', 'type' => CAuthItem::TYPE_ROLE), array('class' => 'add-role-link')); ?> </p> <?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'itemsCssClass' => 'table table-bordered table-striped dataTable no-footer', 'template' => '{items}', 'emptyText' => Rights::t('core', 'No roles found.'), 'htmlOptions' => array('class' => 'grid-view role-table'), 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getGridNameLink()'), array('name' => 'description', 'header' => Rights::t('core', 'Description'), 'type' => 'raw', 'htmlOptions' => array('class' => 'description-column')), array('name' => 'data', 'header' => Rights::t('core', 'Data'), 'type' => 'raw', 'htmlOptions' => array('class' => 'data-column'), 'visible' => Rights::module()->enableBizRuleData === true), array('header' => 'Acciones', 'type' => 'raw', 'htmlOptions' => array('class' => 'center'), 'value' => '$data->getDeleteRoleLink()')))); ?> <p class="info"><?php echo Rights::t('core', 'Values within square brackets tell how many children each item has.'); ?> </p> </div> </div>
<div id="tasks"> <?php $this->beginClip('sidebarHelpText'); ?> <?php echo Rights::t('core', 'A task is a permission to perform multiple operations, for example accessing a group of controller action.'); ?> <br /> <?php echo Rights::t('core', 'Tasks exist below roles in the authorization hierarchy and can therefore only inherit from other tasks and/or operations.'); ?> <?php $this->endClip(); ?> <?php $this->sidebarContent = $this->renderPartial('/_menu', null, true); ?> <?php $this->widget('ext.sgridview.SGridView', array('dataProvider' => $dataProvider, 'template' => '{items}', 'emptyText' => Rights::t('core', 'No tasks found.'), 'htmlOptions' => array('class' => 'grid-view task-table'), 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getGridNameLink()'), array('name' => 'description', 'header' => Rights::t('core', 'Description'), 'type' => 'raw', 'htmlOptions' => array('class' => 'description-column')), array('name' => 'bizRule', 'header' => Rights::t('core', 'Business rule'), 'type' => 'raw', 'htmlOptions' => array('class' => 'bizrule-column'), 'visible' => Rights::module()->enableBizRule === true), array('name' => 'data', 'header' => Rights::t('core', 'Data'), 'type' => 'raw', 'htmlOptions' => array('class' => 'data-column'), 'visible' => Rights::module()->enableBizRuleData === true), array('header' => ' ', 'type' => 'raw', 'htmlOptions' => array('class' => 'actions-column'), 'value' => '$data->getDeleteTaskLink()')))); ?> <div class="hint"><?php echo Rights::t('core', 'Values within square brackets tell how many children each item has.'); ?> </div> </div>
'header'=>Rights::t('core', 'Description'), 'type'=>'raw', 'htmlOptions'=>array('class'=>'description-column'), ), array( 'name'=>'bizRule', 'header'=>Rights::t('core', 'Business rule'), 'type'=>'raw', 'htmlOptions'=>array('class'=>'bizrule-column'), 'visible'=>Rights::module()->enableBizRule===true, ), array( 'name'=>'data', 'header'=>Rights::t('core', 'Data'), 'type'=>'raw', 'htmlOptions'=>array('class'=>'data-column'), 'visible'=>Rights::module()->enableBizRuleData===true, ), array( 'header'=>' ', 'type'=>'raw', 'htmlOptions'=>array('class'=>'actions-column'), 'value'=>'$data->getDeleteTaskLink()', ), ) )); ?> <p class="info"><?php echo Rights::t('core', 'Values within square brackets tell how many children each item has.'); ?></p> </div>
public function getUserRole($userId = false) { $authorizer = Rights::module()->getAuthorizer(); if ($userId) { $roles = $authorizer->getAuthItems(2, $userId); } else { $roles = $authorizer->getAuthItems(2, Yii::app()->user->id); } $role = array_keys($roles); return $role[0]; }