No project description provided
Project description
python-yacedar
Simple, straitforward wrapper for Rust Cedar policy language.
Installation
pip install yacedar
Usage
See /sample
directory.
'''
1. Policy structure
https://www.cedarpolicy.com/en/tutorial/policy-structure
'''
import yacedar
policy_set = yacedar.PolicySet('''\
permit(
principal == User::"alice",
action == Action::"update",
resource == Photo::"VacationPhoto94.jpg"
);
''')
request = yacedar.Request(
principal = yacedar.EntityUid('User', 'alice'),
action = yacedar.EntityUid('Action', 'update'),
resource = yacedar.EntityUid('Photo', 'VacationPhoto94.jpg'),
)
authorizer = yacedar.Authorizer()
response = authorizer.is_authorized(request, policy_set)
# expected: True
print(response.allowed)
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
yacedar-0.1.1.tar.gz
(18.1 kB
view hashes)
Built Distribution
Close
Hashes for yacedar-0.1.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7618a86fef1cd4ba5c801c10e35ea6ecec2c8b0e52cdbc1d4ba565ba0d045179 |
|
MD5 | 189c22ae30653e2c9bbb750695547803 |
|
BLAKE2b-256 | 680845d1d7602cf9c3a50835fac0743431a68f0d8d5dc4229efdf6ac7a75cc57 |