|
|
@@ -81,7 +81,7 @@
|
|
|
<script setup>
|
|
|
import { ref, onMounted } from "vue";
|
|
|
import { useAuth } from "src/composables/useAuth";
|
|
|
-import { componentsStore } from "src/stores/component";
|
|
|
+import { permissionStore } from "src/stores/permission";
|
|
|
import { useI18n } from "vue-i18n/dist/vue-i18n";
|
|
|
|
|
|
const auth = useAuth();
|
|
|
@@ -97,7 +97,7 @@ const menus = ref([
|
|
|
icon: "mdi-home-variant-outline",
|
|
|
disable: false,
|
|
|
permission: false,
|
|
|
- componente: "vuePageDashboard",
|
|
|
+ permissionScope: "dashboard",
|
|
|
},
|
|
|
{
|
|
|
type: "expansive",
|
|
|
@@ -105,7 +105,7 @@ const menus = ref([
|
|
|
icon: "mdi-cog-outline",
|
|
|
disable: false,
|
|
|
permission: false,
|
|
|
- componente: "vuePageConfiguracoes",
|
|
|
+ permissionScope: "config",
|
|
|
childrens: [
|
|
|
{
|
|
|
type: "single",
|
|
|
@@ -114,22 +114,22 @@ const menus = ref([
|
|
|
icon: "mdi-account-multiple-outline",
|
|
|
disable: false,
|
|
|
permission: false,
|
|
|
- componente: "vuePageUsuarios",
|
|
|
+ permissionScope: "usuarios",
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
const getMenuAccess = () => {
|
|
|
- const { getAccess } = componentsStore();
|
|
|
+ const { getAccess } = permissionStore();
|
|
|
menus.value = menus.value
|
|
|
.map((menu) => {
|
|
|
if (menu.type === "expansive") {
|
|
|
- if (getAccess(menu.componente, "menu")) {
|
|
|
+ if (getAccess(menu.permissionScope, "menu")) {
|
|
|
menu.permission = true;
|
|
|
}
|
|
|
menu.childrens = menu.childrens.filter((children) => {
|
|
|
- children.permission = getAccess(children.componente, "menu");
|
|
|
+ children.permission = getAccess(children.permissionScope, "menu");
|
|
|
return children.permission;
|
|
|
});
|
|
|
return menu.childrens.length > 0 ? menu : null;
|
|
|
@@ -137,7 +137,7 @@ const getMenuAccess = () => {
|
|
|
if (menu.componente === "vuePageDashboard") {
|
|
|
menu.permission = true;
|
|
|
} else {
|
|
|
- menu.permission = getAccess(menu.componente, "menu");
|
|
|
+ menu.permission = getAccess(menu.permissionScope, "menu");
|
|
|
}
|
|
|
return menu.permission ? menu : null;
|
|
|
}
|