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

parent 28d49acb
<template>
<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">
<h3>{{ name }}</h3>
<div v-for="(permissionActions, subPermissionTitle) in value" :key="subPermissionTitle">
......@@ -84,6 +99,11 @@
this.permissions[`${permissionPart}.${key}`] = state;
});
},
changeStateForAll(state) {
_.forEach(this.permissions, (index, permission) => {
this.permissions[permission] = state;
});
},
fetchPermissions() {
axios.get(route('api.user.permissions.index'))
.then((response) => {
......
......@@ -106583,6 +106583,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
mixins: [_StringHelpers2.default],
......@@ -106614,12 +106629,19 @@ exports.default = {
_this.permissions[permissionPart + '.' + key] = state;
});
},
fetchPermissions: function fetchPermissions() {
changeStateForAll: function changeStateForAll(state) {
var _this2 = this;
_.forEach(this.permissions, function (index, permission) {
_this2.permissions[permission] = state;
});
},
fetchPermissions: function fetchPermissions() {
var _this3 = this;
_axios2.default.get(route('api.user.permissions.index')).then(function (response) {
_this2.loading = false;
_this2.allPermissions = response.data.permissions;
_this3.loading = false;
_this3.allPermissions = response.data.permissions;
});
}
},
......@@ -106645,6 +106667,71 @@ var render = function() {
var _c = _vm._self._c || _h
return _c(
"div",
[
_c(
"p",
{ staticClass: "pull-right" },
[
_c(
"el-button",
{
attrs: { type: "text" },
on: {
click: function($event) {
_vm.changeStateForAll(1)
}
}
},
[
_vm._v(
"\n " +
_vm._s(_vm.trans("roles.allow all")) +
"\n "
)
]
),
_vm._v(" "),
_c(
"el-button",
{
attrs: { type: "text", disabled: _vm.isRole },
on: {
click: function($event) {
_vm.changeStateForAll(0)
}
}
},
[
_vm._v(
"\n " +
_vm._s(_vm.trans("roles.inherit all")) +
"\n "
)
]
),
_vm._v(" "),
_c(
"el-button",
{
attrs: { type: "text" },
on: {
click: function($event) {
_vm.changeStateForAll(-1)
}
}
},
[
_vm._v(
"\n " +
_vm._s(_vm.trans("roles.deny all")) +
"\n "
)
]
)
],
1
),
_vm._v(" "),
_vm._l(_vm.allPermissions, function(value, name) {
return _c(
"div",
......@@ -106850,6 +106937,8 @@ var render = function() {
2
)
})
],
2
)
}
var staticRenderFns = []
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