I like the proposal of different scaffolding applications.
Furthermore, I think that new people exploring the framework would
gain from more consistent documentation. Over the past few weeks I
have been trying to get my head around the Auth class. According to
the online documentation this is how it works:
Authorization
Once you have a user identified by user.id, you can create a group
(for example "Manager")
group_id = auth.add_group(role = "Manager", description = "example of
a group")
make the user a member:
auth.add_membership(group_id,user_id)
and assign permissions to all members of the group:
auth.add_permission(group_id,'create','tablename',record_id)
Now you can enforce permissions using the following decorators:
>From exploring tools.py I learned that this is how it works for real:
When a user registers, a new group is created and the user is made the
sole member of that group.
def register(...):
...
description = \
'group uniquely assigned to %(first_name)s %(last_name)s'\
% form.vars
group_id = self.add_group("user_%s" % form.vars.id, description)
self.add_membership(group_id, form.vars.id)
...
For example, when I register a person a new auth_user is created
(auth_user.id 1), a new auth_group is created (auth_group.id 1,
auth_group.role user_1, auth_group.description group uniquely assigned
to annet vermeer) and a new auth_membership is created
(auth_membership.id 1, auth.membership.user_id 1,
auth_membership.group_id 1) . Except for the inconsistency between the
documentation and the implementation in web2py, the implementation in
web2py makes the auth_group and auth_membership tables redundant, and
permissions might as well be assigned directly to the user in the
auth_user table.
I think that with the release of web2py version 1.62 web2py's learning
curve is getting increasingly steeper.
Kind regards,
Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---