Example #1
0
    def roles(self, id):

        c.person = Person.find_by_id(id)
        c.roles = Role.find_all()
        if not c.person.activated:
            h.flash(
                "NOTICE: This user hasn't confirmed their email address yet."
                " Please get them to visit"
                " %s" % h.full_url_for('person/activate'),
                category='warning')
        return render('person/roles.mako')
Example #2
0
    def _roles(self, id):
        """ Lists and changes the person's roles. """

        c.person = Person.find_by_id(id)
        c.roles = Role.find_all()

        role = self.form_result['role']
        action = self.form_result['action']

        role = Role.find_by_name(name=role)

        if action == 'Revoke' and role in c.person.roles:
            c.person.roles.remove(role)
            h.flash('Role ' + role.name + ' Revoked')
        elif action == 'Grant' and role not in c.person.roles:
            c.person.roles.append(role)
            h.flash('Role ' + role.name + ' Granted')
        else:
            h.flash("Nothing to do")

        meta.Session.commit()

        return render('person/roles.mako')
Example #3
0
    def roles(self, id):

        c.person = Person.find_by_id(id)
        c.roles = Role.find_all()
        return render('person/roles.mako')
Example #4
0
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
Example #5
0
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
Example #6
0
    def roles(self, id):

        c.person = Person.find_by_id(id)
        c.roles = Role.find_all()
        return render('person/roles.mako')