Skip to content

Commit

Permalink
minor tweaks after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Oct 11, 2024
1 parent 8aee735 commit 460b3fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions frontend/src/components/VaultList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<Menu as="div" class="relative inline-block text-left">
<div>
<MenuButton :disabled="isLicenseViolated || !canCreateVaults" class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-d1 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary" :class="{ 'cursor-not-allowed opacity-50': isLicenseViolated || !canCreateVaults }">
<MenuButton :disabled="isLicenseViolated || !canCreateVaults" class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-primary hover:bg-primary-d1 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50">
{{ t('vaultList.addVault') }}
<ChevronDownIcon class="-mr-1 ml-2 h-5 w-5" aria-hidden="true" />
</MenuButton>
Expand Down Expand Up @@ -147,8 +147,8 @@ const roleOfSelectedVault = computed<VaultRole | 'NONE'>(() => {
}
});
const isAdmin = ref<boolean>();
const canCreateVaults = ref<boolean>();
const isAdmin = ref<boolean>(false);
const canCreateVaults = ref<boolean>(false);
const licenseStatus = ref<LicenseUserInfoDto>();
const isLicenseViolated = computed(() => {
if (licenseStatus.value) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import VaultList from '../components/VaultList.vue';
import Forbidden from '../components/Forbidden.vue';

function checkRole(role: string): NavigationGuardWithThis<undefined> {
return async () => {
return async (to, _) => {
const auth = await authPromise;
if (auth.hasRole(role)) {
return true;
} else {
console.warn(`Access denied: User requires role ${role} to access ${to.fullPath}`);
return { path: '/app/forbidden', replace: true };
}
};
Expand Down

0 comments on commit 460b3fa

Please sign in to comment.