mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
refactor(tags): update permission checks for tag access
- Replaced role-based access control with permission-based checks for tag visibility in the side menu. - Updated API route handlers to utilize protected procedures for tag queries, enhancing security and consistency in permission management.
This commit is contained in:
@@ -331,8 +331,7 @@ const MENU: Menu = {
|
||||
title: "Tags",
|
||||
url: "/dashboard/settings/tags",
|
||||
icon: Tags,
|
||||
isEnabled: ({ auth }) =>
|
||||
!!(auth?.role === "owner" || auth?.role === "admin"),
|
||||
isEnabled: ({ permissions }) => !!permissions?.tag.read,
|
||||
},
|
||||
{
|
||||
isSingle: true,
|
||||
|
||||
@@ -47,7 +47,7 @@ export const tagRouter = createTRPCRouter({
|
||||
}
|
||||
}),
|
||||
|
||||
all: withPermission("tag", "read").query(async ({ ctx }) => {
|
||||
all: protectedProcedure.query(async ({ ctx }) => {
|
||||
try {
|
||||
const organizationTags = await db.query.tags.findMany({
|
||||
where: eq(tags.organizationId, ctx.session.activeOrganizationId),
|
||||
@@ -64,7 +64,7 @@ export const tagRouter = createTRPCRouter({
|
||||
}
|
||||
}),
|
||||
|
||||
one: withPermission("tag", "read")
|
||||
one: protectedProcedure
|
||||
.input(apiFindOneTag)
|
||||
.query(async ({ input, ctx }) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user