Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
disable inherit permissions in role permissions multiselect
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokopenko committed Oct 11, 2017
1 parent 6c0156b commit 720c00f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=====================

v1.0.1
---------------------
* Disable inherit permissions in role permissions selector.

v1.0
---------------------
* Rbac console command to init, assign, scan roles
Expand Down
2 changes: 2 additions & 0 deletions src/views/roles/_permission-options.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
/* @var $this \yii\web\View */
/* @var $treeItems array */
/* @var $disabled bool */

use yii\helpers\Html;

?>
<?php foreach ($treeItems as $item) : ?>
<option value="<?= Html::encode($item['name']) ?>" data-weight="<?= $item['order']; ?>"
<?= !empty($disabled)? 'disabled="disabled"' : '' ?>
style="padding-left: <?= $item['depth'] * 20; ?>px;" selected="selected">
<?= Html::encode($item['name']) ?>
</option>
Expand Down
2 changes: 1 addition & 1 deletion src/views/roles/_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<?php if (!empty($inheritTree)) : ?>
<optgroup label="Inherit Permissions" data-weight="<?= end($inheritTree)['order']; ?>">
<?= $this->render('_permission-options', ['treeItems' => $inheritTree]); ?>
<?= $this->render('_permission-options', ['treeItems' => $inheritTree, 'disabled' => true]); ?>
</optgroup>
<?php endif; ?>
</select>
Expand Down

0 comments on commit 720c00f

Please sign in to comment.