I have two groups and I would like to add users to those groups; the groups 
are Manager and Assistant.

def adminAdd():
    
    assistant = request.vars.assistant
    manager = request.vars.manager
    
    if assistant==manager:

        user = auth.register_bare(
                    email=email,password=password,
                    )
        if user:
                return auth.add_membership(group_id, user_id)

        else: 
            return  auth.add_membership(group_id, user_id)

    return redirect(URL('admin'))


I would like to know how to get the group_id and user_id

Below is my view:
          <form method="post" action="{{=URL('adminAdd')}}" > 
                        <div class="form-group">
                            <label for="exampleInputEmail1">Email</label>
                            <input type="email" name="email" 
class="form-control" id="exampleInputEmail1" placeholder="email">
                        </div>

                        <div class="form-group">
                            <label 
for="exampleInputPassword1">Password</label>
                            <input type="password" name="password" 
class="form-control" id="exampleInputPassword1" placeholder="password">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputPassword1">Confirm 
password</label>
                            <input type="password" name="confirmPassword" 
class="form-control" id="exampleInputPassword1" placeholder="Confirm 
password">
                        </div>
                        <select class="form-control">
                          <option value="Select Role" selected>Select 
Role</option>
                          <option value=">Asistant">Assitant</option>
                          <option value="Manager">Manager</option>
                        </select> 
                          <br>

                        <button type="submit" value="adminAdd" class="btn 
btn-primary">Add admin</button>
                    </form>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to