Adding the ability to allow, inherit or deny for all permissions at once

parent 28d49acb
<template> <template>
<div> <div>
<p class="pull-right">
<el-button type="text"
@click="changeStateForAll(1)">
{{ trans('roles.allow all') }}
</el-button>
<el-button type="text"
:disabled="isRole"
@click="changeStateForAll(0)">
{{ trans('roles.inherit all') }}
</el-button>
<el-button type="text"
@click="changeStateForAll(-1)">
{{ trans('roles.deny all') }}
</el-button>
</p>
<div v-for="(value, name) in allPermissions" :key="name"> <div v-for="(value, name) in allPermissions" :key="name">
<h3>{{ name }}</h3> <h3>{{ name }}</h3>
<div v-for="(permissionActions, subPermissionTitle) in value" :key="subPermissionTitle"> <div v-for="(permissionActions, subPermissionTitle) in value" :key="subPermissionTitle">
...@@ -84,6 +99,11 @@ ...@@ -84,6 +99,11 @@
this.permissions[`${permissionPart}.${key}`] = state; this.permissions[`${permissionPart}.${key}`] = state;
}); });
}, },
changeStateForAll(state) {
_.forEach(this.permissions, (index, permission) => {
this.permissions[permission] = state;
});
},
fetchPermissions() { fetchPermissions() {
axios.get(route('api.user.permissions.index')) axios.get(route('api.user.permissions.index'))
.then((response) => { .then((response) => {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment