[chore] fix permissions

This commit is contained in:
Tim Gröger 2021-11-16 11:45:22 +01:00
parent 9be678b74f
commit c5bdebb94f
3 changed files with 15 additions and 6 deletions

View File

@ -11,7 +11,7 @@
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { defineComponent, ref, onMounted } from 'vue';
import MainUserSettings from './settings/MainUserSettings.vue';
import UserSelector from './UserSelector.vue';
import { useMainStore, useUserStore } from '@flaschengeist/api';
@ -24,6 +24,10 @@ export default defineComponent({
const userStore = useUserStore();
const user = ref(mainStore.currentUser);
onMounted(() => {
void userStore.getUsers(true)
})
async function updateUser(value: FG.User) {
await userStore.updateUser(value);
user.value = value;

View File

@ -61,14 +61,19 @@ export default defineComponent({
interface Tab {
name: string;
label: string;
permissions: Array<string>;
}
const tabs: Tab[] = [
{ name: 'user', label: 'Mitglieder' },
{ name: 'newUser', label: 'Neues Mitglied' },
{ name: 'roles', label: 'Rollen' },
{ name: 'user', label: 'Mitglieder', permissions: [PERMISSIONS.EDIT_OTHER, PERMISSIONS.SET_ROLES] },
{ name: 'newUser', label: 'Neues Mitglied', permissions: [PERMISSIONS.SET_ROLES] },
{ name: 'roles', label: 'Rollen', permissions: [PERMISSIONS.ROLES_EDIT] },
];
const _tabs = computed(() => tabs.filter(tab => {
return tab.permissions.every(permission => hasPermission(permission))
}))
const drawer = ref<boolean>(false);
const showDrawer = computed({
@ -86,7 +91,7 @@ export default defineComponent({
canEditRoles,
showDrawer,
tab,
tabs,
tabs: _tabs,
};
},
});

View File

@ -25,7 +25,7 @@ import { defineComponent, onBeforeMount, ref } from 'vue';
import Session from '../components/settings/Session.vue';
export default defineComponent({
// name: 'PageName'
name: 'UserSettings',
components: { Session, MainUserSettings },
setup() {
const mainStore = useMainStore();