diff --git a/backend/src/server/routes/v1/admin-router.ts b/backend/src/server/routes/v1/admin-router.ts index cb91e7c86..076b33e54 100644 --- a/backend/src/server/routes/v1/admin-router.ts +++ b/backend/src/server/routes/v1/admin-router.ts @@ -213,12 +213,12 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => { server.route({ method: "PATCH", - url: "/user-management/users/grant-admin-access", + url: "/user-management/users/:userId/admin-access", config: { rateLimit: writeLimit }, schema: { - body: z.object({ + params: z.object({ userId: z.string() }) }, @@ -228,7 +228,7 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => { }); }, handler: async (req) => { - await server.services.superAdmin.grantServerAdminAccessToUser(req.body.userId); + await server.services.superAdmin.grantServerAdminAccessToUser(req.params.userId); } }); diff --git a/backend/src/services/super-admin/super-admin-service.ts b/backend/src/services/super-admin/super-admin-service.ts index 57162c2e9..166f73317 100644 --- a/backend/src/services/super-admin/super-admin-service.ts +++ b/backend/src/services/super-admin/super-admin-service.ts @@ -297,10 +297,7 @@ export const superAdminServiceFactory = ({ message: "Failed to grant server admin access to user due to plan restriction. Upgrade to Infisical's Pro plan." }); } - - await userDAL.transaction(async (tx) => { - await userDAL.updateById(userId, { superAdmin: true }, tx); - }); + await userDAL.updateById(userId, { superAdmin: true }); }; const getAdminSlackConfig = async () => { diff --git a/docs/documentation/platform/admin-panel/server-admin.mdx b/docs/documentation/platform/admin-panel/server-admin.mdx index f0b173d46..137cdde59 100644 --- a/docs/documentation/platform/admin-panel/server-admin.mdx +++ b/docs/documentation/platform/admin-panel/server-admin.mdx @@ -76,8 +76,7 @@ This tab allows you to set various rate limits for your Infisical instance. You ## User Management Tab -From this tab, you can view all the users who have signed up for your instance. You can search for users using the search bar and remove them from your instance by pressing the **X** button on their respective row. - +From this tab, you can view all the users who have signed up for your instance. You can search for users using the search bar and remove them from your instance by clicking on the three dots icon on the right. Additionally, the Server Admin can grant server administrator access to other users through this menu. ![User Management](/images/platform/admin-panels/admin-panel-users.png) diff --git a/docs/images/platform/admin-panels/admin-panel-users.png b/docs/images/platform/admin-panels/admin-panel-users.png index 94add6d85..1f56f2f2d 100644 Binary files a/docs/images/platform/admin-panels/admin-panel-users.png and b/docs/images/platform/admin-panels/admin-panel-users.png differ diff --git a/frontend/src/hooks/api/admin/mutation.ts b/frontend/src/hooks/api/admin/mutation.ts index 23e25ea60..901c079a0 100644 --- a/frontend/src/hooks/api/admin/mutation.ts +++ b/frontend/src/hooks/api/admin/mutation.ts @@ -74,7 +74,7 @@ export const useAdminGrantServerAdminAccess = () => { const queryClient = useQueryClient(); return useMutation({ mutationFn: async (userId: string) => { - await apiRequest.patch("/api/v1/admin/user-management/users/grant-admin-access", { userId }); + await apiRequest.patch(`/api/v1/admin/user-management/users/${userId}/admin-access`); return {}; }, onSuccess: () => {