-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* generic permission middleware * placeholder middleware implementations * implement isAdmin check * permissions on admin page + fix typo * logical functions for conditions * pass MiddlewareContext to conditions * permission to check if user is part of subject * permission to check if user can create a project for a subject * run formatter * restructure navigation guard middlewares * subject details permissions * project details permissions * go to /not-found instead of /forbidden * create project permissions * fix project permission checks * permissions for submit page * permissions for groups overview * permissions for group details * permissions for submission list of project * remove unused imports * Apply suggestions from code review Co-authored-by: Xander Bil <[email protected]> * permissions for new pages * allow admins to visit all pages --------- Co-authored-by: Xander Bil <[email protected]>
- Loading branch information
1 parent
34d3314
commit 889e485
Showing
13 changed files
with
361 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { computed } from "vue"; | ||
import { useCurrentUserQuery } from "@/queries/User"; | ||
import type { QueryClient } from "@tanstack/vue-query"; | ||
|
||
export default function useIsAdmin() { | ||
const { data: user } = useCurrentUserQuery(); | ||
export default function useIsAdmin(queryClient?: QueryClient) { | ||
const { data: user, isLoading } = useCurrentUserQuery(queryClient); | ||
const isAdmin = computed(() => user.value?.is_admin || false); | ||
return { isAdmin }; | ||
return { isAdmin, isLoading }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { computed } from "vue"; | ||
import { useCurrentUserQuery } from "@/queries/User"; | ||
import type { QueryClient } from "@tanstack/vue-query"; | ||
|
||
export default function useIsTeacher() { | ||
const { data: user } = useCurrentUserQuery(); | ||
export default function useIsTeacher(queryClient?: QueryClient) { | ||
const { data: user, isLoading } = useCurrentUserQuery(queryClient); | ||
const isTeacher = computed(() => user.value?.is_teacher || false); | ||
return { isTeacher }; | ||
return { isTeacher, isLoading }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.