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 m_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"
}
request_access = {
"deal": {
# "block": "KHCN",
# "scope_code": "MB##HN##CAU_GIAY"
}
}
pdb = PolicyDecisionPoint(merchant_id=merchant_id, resource=resource, action=action, account_id=account_id,
user_info=user_info, request_access=request_access)
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.2.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for m_abac_anhnt-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf9418b26160561129162507af053955b1889cf1680b36c466313c2751a537e |
|
MD5 | 7ced16a287bba2e8560eaf1d2e49f430 |
|
BLAKE2b-256 | 43f3e82773b0c24210c811167215a8f2e9b1bad5aa5920c55e355601c1476e82 |