update phân quyền chi tiết

This commit is contained in:
2020-11-02 14:35:22 +07:00
parent c4bb81e55c
commit e4a665dd2e
29 changed files with 1188 additions and 343 deletions

View File

@@ -40,11 +40,13 @@ use yii\widgets\ActiveForm;
Báo cáo
</a>
</li>
<li class="<?php if (in_array($this->context->id, ['user'])) echo "active"; ?>">
<a href="<?php echo \yii\helpers\Url::to(['/user']); ?>">
Hệ thống
</a>
</li>
<?php if (Yii::$app->user->can("administrator")) { ?>
<li class="<?php if (in_array($this->context->id, ['user', 'auth-item'])) echo "active"; ?>">
<a href="<?php echo \yii\helpers\Url::to(['/user']); ?>">
Hệ thống
</a>
</li>
<?php } ?>
</ul>
</div>
<div class="navbar-custom-menu">

View File

@@ -8,35 +8,36 @@
$items = [
['label' => 'Phòng ban', 'url' => ['/department'], 'icon' => 'building'],
['label' => 'Nhân viên', 'url' => ['/staff'], 'icon' => 'users'],
['label' => 'Đăng ký thẻ', 'url' => ['/card-register'], 'icon' => 'credit-card']
['label' => 'Đăng ký thẻ', 'url' => ['/card-register'], 'icon' => 'credit-card', 'visible' => Yii::$app->user->can("staffCardRegister")]
];
}
if (in_array($this->context->id, ['area', 'device'])) {
$items = [
['label' => 'Khu vực', 'url' => ['/area'], 'icon' => 'building'],
['label' => 'Thiết bị', 'url' => ['/device'], 'icon' => 'database'],
['label' => 'Tìm kiếm thiết bị', 'url' => ['/device/search'], 'icon' => 'search']
['label' => 'Tìm kiếm thiết bị', 'url' => ['/device/search'], 'icon' => 'search', 'visible' => Yii::$app->user->can("deviceSearch")]
];
}
if (in_array($this->context->id, ['schedule', 'assign'])) {
$items = [
['label' => 'Lịch trình', 'url' => ['/schedule'], 'icon' => 'calendar'],
['label' => 'Cấp quyền truy cập', 'url' => ['/assign'], 'icon' => 'cogs']
['label' => 'Cấp quyền truy cập', 'url' => ['/assign'], 'icon' => 'cogs', 'visible' => Yii::$app->user->can("scheduleAssign")]
];
}
if (in_array($this->context->id, ['user'])) {
if (in_array($this->context->id, ['user', 'auth-item'])) {
$items = [
['label' => 'Phân quyền', 'url' => ['/auth-item'], 'icon' => 'cogs'],
['label' => 'Người dùng', 'url' => ['/user'], 'icon' => 'users']
];
}
if (in_array($this->context->id, ['logs'])) {
$items = [
['label' => 'Sự kiện hôm nay', 'url' => ['/logs', 'type' => 'today'], 'icon' => 'clock-o'],
['label' => 'Sự kiện 3 ngày gần đây', 'url' => ['/logs', 'type' => '3days'], 'icon' => 'calendar'],
['label' => 'Sự kiện tuần này', 'url' => ['/logs', 'type' => 'thisWeek'], 'icon' => 'calendar'],
['label' => 'Sự kiện tuần trước', 'url' => ['/logs', 'type' => 'lastWeek'], 'icon' => 'calendar'],
['label' => 'Tất cả', 'url' => ['/logs', 'type' => 'all'], 'icon' => 'calendar'],
['label' => 'Báo cáo chấm công', 'url' => ['/logs/statistics'], 'icon' => 'bar-chart']
['label' => 'Sự kiện hôm nay', 'url' => ['/logs', 'type' => 'today'], 'icon' => 'clock-o', 'visible' => Yii::$app->user->can("logsToday")],
['label' => 'Sự kiện 3 ngày gần đây', 'url' => ['/logs', 'type' => '3days'], 'icon' => 'calendar', 'visible' => Yii::$app->user->can("logs3days")],
['label' => 'Sự kiện tuần này', 'url' => ['/logs', 'type' => 'thisWeek'], 'icon' => 'calendar', 'visible' => Yii::$app->user->can("logsThisWeek")],
['label' => 'Sự kiện tuần trước', 'url' => ['/logs', 'type' => 'lastWeek'], 'icon' => 'calendar', 'visible' => Yii::$app->user->can("logsLastWeek")],
['label' => 'Tất cả', 'url' => ['/logs', 'type' => 'all'], 'icon' => 'calendar', 'visible' => Yii::$app->user->can("logsAll")],
['label' => 'Báo cáo chấm công', 'url' => ['/logs/statistics'], 'icon' => 'bar-chart', 'visible' => Yii::$app->user->can("logsStatistics")]
];
}
?>