-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing ui permission condition about users
Signed-off-by: Ryan Wang <[email protected]>
- Loading branch information
Showing
6 changed files
with
53 additions
and
77 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
console/src/modules/contents/_components/ContributorList.vue
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script lang="ts" setup> | ||
import { usePermission } from "@/utils/permission"; | ||
import type { Contributor } from "@halo-dev/api-client"; | ||
import { VAvatar } from "@halo-dev/components"; | ||
import { useRouter } from "vue-router"; | ||
withDefaults( | ||
defineProps<{ | ||
contributors: Contributor[]; | ||
}>(), | ||
{} | ||
); | ||
const router = useRouter(); | ||
const { currentUserHasPermission } = usePermission(); | ||
function handleRouteToUserDetail(contributor: Contributor) { | ||
if (!currentUserHasPermission(["system:users:view"])) { | ||
return; | ||
} | ||
router.push({ | ||
name: "UserDetail", | ||
params: { name: contributor.name }, | ||
}); | ||
} | ||
</script> | ||
|
||
<template> | ||
<VAvatar | ||
v-for="(contributor, contributorIndex) in contributors" | ||
:key="contributorIndex" | ||
v-tooltip="contributor.displayName" | ||
size="xs" | ||
:src="contributor.avatar" | ||
:alt="contributor.displayName" | ||
circle | ||
@click="handleRouteToUserDetail(contributor)" | ||
></VAvatar> | ||
</template> |
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