Giter Site home page Giter Site logo

auth's Issues

permissions shared across roles

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

Where is the role and permission,user save?

#----------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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.