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.5.tar.gz
(22.4 kB
view hashes)
Built Distribution
Close
Hashes for m_abac_anhnt-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2d9fe4abba868324123306cdd09e57acb9340ae27b67532ff3744a1d89c9b4 |
|
MD5 | 798f1436479c929eaa4d71aef8f4e7a1 |
|
BLAKE2b-256 | db4861d37f460639c7aeac1433d79fe986700b72babe5bd72719d6768a70ff12 |