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 details)
Built Distribution
File details
Details for the file m-abac-anhnt-1.0.6.tar.gz
.
File metadata
- Download URL: m-abac-anhnt-1.0.6.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99d16e9d451477d659e5b7312a91d251e78436ea0dd6fd2e3f0e79a52d47b323 |
|
MD5 | 0d4b54a845604d5966ee3a3c56d4a609 |
|
BLAKE2b-256 | 699a175ba13dcc24e8d5f3d60b94b2fa5da297fde9618cd77d0dcc8a103c11fe |
File details
Details for the file m_abac_anhnt-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: m_abac_anhnt-1.0.6-py3-none-any.whl
- Upload date:
- Size: 46.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0af64c20496dfe867019a1d80f364bb985fd2bfe01187a9d91f90cd41186172 |
|
MD5 | 5c2daddca41656974e22a55bed329777 |
|
BLAKE2b-256 | 23a3ab949667ca56f05a908783a58dc7b5067406f3fc422153cee32e8633196c |