예제 #1
0
파일: person.py 프로젝트: CarlFK/zookeepr
    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')
예제 #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')
예제 #3
0
파일: person.py 프로젝트: CarlFK/zookeepr
    def roles(self, id):

        c.person = Person.find_by_id(id)
        c.roles = Role.find_all()
        return render('person/roles.mako')
예제 #4
0
파일: role.py 프로젝트: CarlFK/zookeepr
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
예제 #5
0
    def roles(self, id):

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