Thư viện xử lý kiểm tra quyền theo logic ABAC (Attribute-based access control)
Project description
ABAC Engine
Thư viện xử lý kiểm tra quyền theo logic ABAC (Attribute-based access control).
Cài đặt:
$ pip3 install m-abac
Sử dụng:
Kiểm tra user có quyền thao tác hay không:
from mobio.libs.abac import PolicyDecisionPoint
merchant_id = "1b99bdcf-d582-4f49-9715-1b61dfff3924"
resource = "deal"
# action = "UpdateFromSale"
action = "ListFromSale"
account_id = "704eac91-7416-497f-a17d-d81cfa2d3211"
# thông tin user ko có thì để None
user_info = {
"block": "KHDN",
"scope_code": "MB##HN"
}
pdb = PolicyDecisionPoint(merchant_id=merchant_id, resource=resource, action=action, account_id=account_id,
user_info=user_info)
result = pdb.is_allowed()
if not result.get_allow_access():
# trả về lỗi không có quyền truy cập
Log - 1.0.0
- release sdk
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
m-abac-anhnt-1.0.6.tar.gz
(22.0 kB
view hashes)
Built Distribution
Close
Hashes for m_abac_anhnt-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0af64c20496dfe867019a1d80f364bb985fd2bfe01187a9d91f90cd41186172 |
|
MD5 | 5c2daddca41656974e22a55bed329777 |
|
BLAKE2b-256 | 23a3ab949667ca56f05a908783a58dc7b5067406f3fc422153cee32e8633196c |