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:
Nathnael
2026-07-28 12:27:44 +00:00
parent c2375a5306
commit b1cb149c44
7 changed files with 294 additions and 7 deletions

View File

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

View File

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