Access Control
Best Practices[1]
Scope the Organization Name
A rule of thumb is to prefix resource names with a domain that represents the organization creating the software.
- KHÔNG DÙNG:
<some-id> - DÙNG:
<organizaion-id>:<some-id>
Scope Actions, Resources and Subjects
It is wise to scope actions, resources, and subjects in order to prevent name collisions:
- KHÔNG DÙNG:
myorg.com:<subject-id>, myorg.com:<resource-id>, myorg.com:<action-id> - DÙNG:
myorg.com:subjects:<subject-id>, myorg.com:resources:<resource-id>, myorg.com:actions:<action-id> - DÙNG:
subjects:myorg.com:<subject-id>, resources:myorg.com:<resource-id>, actions:myorg.com:<action-id>
Multi-Tenant Systems
Multi-tenant systems typically have resources which should not be access by other tenants in the system. This can be achieved by adding the tenant id to the URN:
Do: resources:myorg.com:tenants:<tenant-id>:<resource-id>
In some environments, it is common to have organizations and projects belonging to those organizations. Here, the following URN semantics can be used:
Do: resources:myorg.com:organizations:<organization-id>:projects:<project-id>:<resource-id>
Hiện thực
Subject
Users
Các thuộc tính dùng để phân quyền của Users
{
id: string
role: string // role của service là admin hoặc user
}
Resources
Dịch vụ Collector gồm có các loại resource sau:
- Project
{
id: string
}
- ProjectUserGroup
{
id: string
ProjectId: string
}
- Form
{
id: string
}
- Section
{
id: string
}
- FormSection (section thuộc một form cụ thể)
{
id: string
FormId: string
}
Chính sách truy cập
Gồm có 3 loại chính sách:
- Chính sách hệ thống (áp dụng trên mức hệ thống - Ưu tiên cao nhất)
- Chính sách dịch vụ (áp dụng tại dịch vụ - Ưu tiên cao)
- Chính sách dự án (áp dụng trong dự án, được PROJECT OWNER quy định để phù hợp với nghiệp vụ của mình)
Chính sách hệ thống (#TODO dẫn nguồn)
Chính sách dịch vụ
Là các chính sách áp dụng trong Collector Service:
- PROJECT OWNER có toàn quyền trong dự án của mình
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == r.obj.Owner
- RESEARCHER có quyền XEM{Thông tin dự án, thành viên trong dự án}
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub.role == reseacher
- RESEARCHER có quyền XEM, THÊM dữ liệu
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub.role == reseacher
Tài liệu tham khảo
[1] ORY Access Control Policies
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.