ourway / auth Goto Github PK
View Code? Open in Web Editor NEWAuthorization for humans
Home Page: http://auth.readthedocs.org/en/latest/
License: MIT License
Authorization for humans
Home Page: http://auth.readthedocs.org/en/latest/
License: MIT License
Hi @ourway ,
Nice package. I was trying to write some tests and noticed that there's like a one to one relation between Roles and Permissions. It seems intentional ( according to the code ). Wouldn't be great to have permissions shared across roles ?
If so, i would be glad to contribute by submitting a patch
#----------When i use the demo:
from auth import Authorization
from auth import api,serve
secret_key = "pleaSeDoN0tKillMyC_at"
cas = Authorization(secret_key)
cas.add_role('cookers')
cas.add_role('dancers')
cas.add_role('laughers')
cas.add_permission('cookers', 'cook')
cas.add_permission('dancers', 'dance')
cas.add_permission('laughers', 'laugh')
cas.add_membership('sara', 'cookers')
cas.add_membership('jack', 'dancers')
cas.add_membership('susan', 'laughers')
if cas.user_has_permission('jack', 'dance'):
print('YES!!! Jack can dance.')
if cas.user_has_permission('sara', 'dance'):
print('YES!!! sara can dance.')
if cas.user_has_permission('susan', 'dance'):
print('YES!!! susan can dance.')
else:
print('suan can"t dance')
serve('127.0.0.1',4000,api)
#-----------I stoped and restart my code more than once, i say that sara can dance is True,but why?
#------------And i use the order:
http get 127.0.0.1:4000/api/user_permissions/pleaSeDoN0tKillMyC_at/sara
it's result:
HTTP/1.0 200 OK
Date: Thu, 07 Mar 2019 06:15:45 GMT
Server: Werkzeug/0.14.1 Python/3.6.7
content-length: 86
content-type: application/json; charset=UTF-8
{
"results": [
{
"name": "cook"
},
{
"name": "eat"
},
{
"name": "laugh"
},
{
"name": "dance"
}
]
}
#---------the questions is: where is the role and permssion and user save?
There is a typo in CAS.models.db code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.