Trong RBAC phân cấp, một vai trò cấp cao (senior) kế thừa toàn bộ quyền của các vai trò cấp thấp (junior) mà nó chi phối, có tính bắc cầu (transitive).
Cho quyền trực tiếp của các vai trò và các quan hệ kế thừa senior junior, với mỗi truy vấn role permission hãy kiểm tra vai trò có quyền (kể cả kế thừa).
Input:
3
senior manage
mid edit
junior view
2
senior mid
mid junior
2
senior view
junior manage
Output:
ALLOW
DENY
senior kế thừa mid → junior nên có view; junior không có manage.
Dòng 1: R. R dòng role perms.... Dòng kế: E. E dòng senior junior. Dòng kế: Q. Q dòng role permission.
1 ≤ R, Q ≤ 200; 0 ≤ E ≤ 400. Đồ thị kế thừa có thể có chu trình (xử lý an toàn).
Q dòng ALLOW/DENY.
Ví dụ:
Đầu vào:
3
senior manage
mid edit
junior view
2
senior mid
mid junior
2
senior view
junior manage
Đầu ra:
ALLOW
DENY
Giải thích:
Đang tải editor...