本文整理汇总了PHP中Rights::module方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::module方法的具体用法?PHP Rights::module怎么用?PHP Rights::module使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rights
的用法示例。
在下文中一共展示了Rights::module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* 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));
}
示例2: __construct
/**
* 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();
}
示例3: getType
public function getType()
{
if ($this->typeColumn === null) {
$this->typeColumn = Rights::module()->userTypeColumn;
}
return $this->owner->{$this->typeColumn};
}
示例4: getName
/**
* 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};
}
示例5: actionRegistration
/**
* 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));
}
}
示例6: array
<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>
示例7: array
?>
<?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.');
?>
示例8: displayMenu
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))))));
}
示例9: getAssignPermissionLink
/**
* 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'));
}
示例10:
<?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;
?>
示例11: array
<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>
示例12: attachUserBehavior
/**
* 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;
}
示例13: isSuperuser
/**
* 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.'));
}
}
示例14: array
?>
</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>
示例15: array
?>
</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>