mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
feat(backoffice): add organization admin permission assignment page (EDRFREIGHT-242)
There was no UI to assign permissions to the Organization Admin role, even though the backend's Role→Permission endpoints (@tria-plc/iamapi-common's role-permissions routes) were already live and unused. Adds a dedicated page — application picker + the existing permission checklist — that assigns/reads permissions for the fixed Organization Admin role, linked from the Organization Admins page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { withHeaders } from "@/record-management/services/api/withHeaders";
|
||||
import axiosInstance from "@/shared/services/axiosInstance";
|
||||
import { PermissionListResponse } from "@/user-management/dto/permissions/permissonDto";
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
export interface AssignRolePermissionsPayload {
|
||||
firstId: string;
|
||||
secondIds: string[];
|
||||
}
|
||||
|
||||
// GET /role-permissions/given-first/{roleId}
|
||||
export const getPermissionsByRoleId = async (
|
||||
roleId: string,
|
||||
): Promise<AxiosResponse<PermissionListResponse>> =>
|
||||
axiosInstance.get(`/role-permissions/given-first/${roleId}`, {
|
||||
headers: withHeaders(),
|
||||
});
|
||||
|
||||
// POST /role-permissions/assign-seconds-for-first
|
||||
export const assignPermissionsToRole = async (
|
||||
payload: AssignRolePermissionsPayload,
|
||||
): Promise<AxiosResponse<void>> =>
|
||||
axiosInstance.post("/role-permissions/assign-seconds-for-first", payload, {
|
||||
headers: withHeaders(),
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { withHeaders } from "@/record-management/services/api/withHeaders";
|
||||
import axiosInstance from "@/shared/services/axiosInstance";
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
export interface RoleDto {
|
||||
id: string;
|
||||
name: { am: string; en: string };
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface RoleListResponse {
|
||||
count: number;
|
||||
items: RoleDto[];
|
||||
}
|
||||
|
||||
export const getRoles = async (): Promise<AxiosResponse<RoleListResponse>> =>
|
||||
axiosInstance.get("/roles", {
|
||||
headers: withHeaders(),
|
||||
params: { take: 100 },
|
||||
});
|
||||
Reference in New Issue
Block a user