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.3.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for m_abac_anhnt-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90a8e62556b1d69fa82213c5a124a7a3db7333eb4192ee47c977d23958e61b49 |
|
MD5 | 2b423ce26a26df43f82d4887927a4008 |
|
BLAKE2b-256 | 72229529bb8ceef091ba84305f8fba3c92f249593ae93b9480dbb45f7ad969c5 |