stormpath / stormpath-flask

Build simple, secure web applications with Stormpath and Flask!
http://flask-stormpath.readthedocs.org/en/latest/
Other
155 stars 31 forks source link

Enforce User Authorization docs section could be clearer #66

Open artburkart opened 8 years ago

artburkart commented 8 years ago

Hi,

I noticed the documentation for the Enforce User Authorization section may be a little off.

It says

>>> directory = stormpath_manager.application.default_account_store_mapping.account_store

>>> free_users = directory.groups.create({'name': 'free users'})
>>> paid_users = directory.groups.create({'name': 'paid users'})
>>> admins = directory.groups.create({'name': 'admins'})

>>> # Put the current user into the 'Free Users' group.
>>> user.add_group(free_users)

but I couldn't get it to work unless I used the following

directory = stormpath_manager.application.default_group_store_mapping.account_store

Maybe the library has been updated, but the docs not?

Also, as a point of clarity, it may be helpful to point out creating groups doesn't need to be done in code at all, that it can be done through your UI instead. While I was able to deduce from the >>> that I shouldn't add this code to my app, it may not be entirely clear to a Python newbie that the snippet is only meant to be executed as a one-off in the CLI.

Cheers :smile: