On Monday, October 24, 2011 8:04:25 AM UTC-4, lucas wrote: > > > first i want to shutoff the default of creating a new group for each > registered person. what is the setting to override that default > behavior? >
auth.settings.create_user_groups = False See http://web2py.com/book/default/chapter/08#Settings-and-Messages > > i am "auth.settings.registration_requires_approval = True" so that i > can manually manage users and the group they belong to and their > associated permissions. when i approve the user by erasing pending > under auth_user, i want to assign them to one of six groups i setup in > auth_group. each group has its own permission under auth_permission. > what is the best way to setup groups (roles) and permissions in web2py > and then assign that group or role to the newly allowed user? is > their a web2py admin interface for this besides the web2py database > admin interface? > No. You'll have to use appadmin or create your own interface, which is very easy to do with Crud or now with the new SQLFORM.grid/smartgrid (though that still isn't documented in the book). You can also do it programmatically by writing DAL inserts/updates -- either in a web2py shell or by running a script via the command line (see http://web2py.com/book/default/chapter/04#Command-Line-Options). Note, when doing DB operations via the shell or scripts, you need to explicitly commit transactions via db.commit() (see http://web2py.com/book/default/chapter/06#commit-and-rollback). > > and lastly, how to decorate my functions with either group/role or > permissions to either allow or deny that function? @auth.requires_membership(...) @auth.requires_permission(...) @auth.requires(any_set_of_conditions) See http://web2py.com/book/default/chapter/08#Decorators, http://web2py.com/book/default/chapter/08#Combining-Requirements. > also, what is the > best way to check in a controller function or view that group/role or > permission once the user is logged in to verify the user and either > display or not display certain information? > if auth.has_membership(...): do something else: don't do it Similarly for auth.has_permission(...). See http://web2py.com/book/default/chapter/08#Authorization. Anthony