Update Server Admin Console documentation and add a fix for endpoint /admin-access

This commit is contained in:
carlosmonastyrski
2025-03-04 15:29:34 -03:00
parent 08ec8c9b73
commit bbf60169eb
5 changed files with 6 additions and 10 deletions

View File

@@ -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);
}
});

View File

@@ -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 () => {

View File

@@ -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)
<Note>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 288 KiB

View File

@@ -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: () => {