https://github.com/elcio/badmin
On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina <[email protected] > wrote: > I am not sure exactly what you want. > > You can create group by the appadmin, and you only need to do it once for > each group. For the assignation of user to a given group, with the appadmin > you have to do it many time (one for each group member, one at a time), if > you have to review/add new group member frequently you can create a > controller function for this... > > The access to this function should be restrict as above. > > You will need a custom widget I guess to make the user membre picking > easier (not having to populate the membership table one at a time), maybe > SQLFORM.factory() is a better choice then SQLFORM() in this case to > construct custom field for the user member picking... Sorry, I don't have > any pseudo or code that come to mind rapidly, but for sure you can find and > reuse code available here on the list... Also, there is a better appadmin > admi interface call badmin or badadmin, you could maybe find code for this, > or see how it is programmed. There is also web2pyslice where it may be > possible to find code snippet for this. > > Hopes it helps > > Richard > > > On Mon, Oct 28, 2013 at 12:13 PM, raferbop <[email protected]> wrote: > >> Richard, I was about to post a similar question, but let me just ask you. >> I am also new to web2py, and I am not able to find any good resources in >> relation to creating multiple groups or assigning roles to users. For >> example, lets say I have a group of users that I want to categorize as >> company, drivers, and passengers. Can you shed some light of how I can take >> the built-in auth_user function and create these various groups. >> >> Rafer >> >> >> On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote: >> >>> If you are sure that the user that will be manage by other user is 1 to >>> many (many users that can declared which user is their manager), you can do >>> that (self-reference). But this is only one part of the problem, I think >>> you need to create a group of admin_user that are allow to manage other >>> users, the one that reference them, so you can get the list of users that >>> are mananagable by a given admin user like so : db(db.auth_user.id == >>> auth.user_id).select(db.auth_**user.id <http://db.auth_user.id>) in >>> this case the auth.user_id is the admin user that is authenticated. >>> >>> You better have a group of admin and user web2py RBAC to make sure you >>> have a better controller over the users allowed to manage other users. That >>> way, you can user the web2py tool to make sure only the users that have >>> right can access you manage_user function, something like that : >>> >>> @auth.requires_login() >>> @auth.requires(lambda: auth.has_membership('admin')) >>> def manage_user(): >>> rows = db(db.auth_user.id == >>> auth.user_id).select(db.auth_**user.id<http://db.auth_user.id> >>> ) >>> id_of_users_to_be_managed = [row.id for row in rows] >>> if request.vars.user_id in id_of_users_to_be_managed: >>> form = SQLFORM(db.auth_user, user_id) >>> ... >>> else: >>> form = 'You can't manage this user' >>> return dict(form=form) >>> >>> >>> :) >>> >>> Richard >>> >>> >>> >>> >>> >>> >>> On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg <[email protected]>wrote: >>> >>>> Hi there and thanks for a stellar project - really cool. I am trying >>>> to solve an issue that arose and was hoping for a pointer so I can solve >>>> it. >>>> >>>> I am wanting to use the authentication mechanism of web2py pretty much >>>> as is, but I need to be able to have one registered user, in some cases, be >>>> given the ability to administrate and act as other registered users. >>>> My thoughts were along the lines of adding a column parent_of to >>>> auth_user and if an id is specified here pointing towards another user, the >>>> specified id can administrate as that user. Would this be a proper way to >>>> go about it, and how could this be implemented? >>>> >>>> Any thoughts or ideas would be welcome. >>>> >>>> Tnx, Mikael >>>> >>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/**web2py >>>> <http://github.com/web2py/web2py>(Source code) >>>> - >>>> https://code.google.com/p/**web2py/issues/list<https://code.google.com/p/web2py/issues/list>(Report >>>> Issues) >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "web2py-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to web2py+un...@**googlegroups.com. >>>> >>>> For more options, visit >>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

