示例#1
0
文件: person.py 项目: iseppi/zookeepr
    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')
示例#2
0
文件: person.py 项目: iseppi/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')
示例#3
0
    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 项目: Ivoz/zookeepr
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
示例#5
0
文件: role.py 项目: tmfox/zookeepr
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
示例#6
0
文件: person.py 项目: tmfox/zookeepr
    def roles(self, id):

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