Exemplo n.º 1
0
    def role_exists(self, role):
        """
        Returns ``True`` if the role exists, ``False`` otherwise. Roles are
        case insensitive.
        """
        role = Role.find_by_name(role)

        if role is not None:
            return True
        return False
Exemplo n.º 2
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('funding_reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for ft in c.funding_types:
            stuff = Funding.find_all_by_funding_type_id(ft.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % ft.name, stuff)

        return render('funding/list_review.mako')
Exemplo n.º 3
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('funding_reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for ft in c.funding_types:
            stuff = Funding.find_all_by_funding_type_id(
                ft.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % ft.name, stuff)

        return render('funding/list_review.mako')
Exemplo n.º 4
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for pt in c.proposal_types:
            stuff = Proposal.find_all_by_proposal_type_id(pt.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % pt.name, stuff)
        for aat in c.accommodation_assistance_types:
            stuff = Proposal.find_all_by_accommodation_assistance_type_id(aat.id)
            setattr(c, '%s_collection' % aat.name, stuff)
        for tat in c.travel_assistance_types:
            stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
            setattr(c, '%s_collection' % tat.name, stuff)

        return render('proposal/list_review.mako')
Exemplo n.º 5
0
    def review_index(self):
        c.person = h.signed_in_person()
        c.num_proposals = 0
        reviewer_role = Role.find_by_name('reviewer')
        c.num_reviewers = len(reviewer_role.people)
        for pt in c.proposal_types:
            stuff = Proposal.find_all_by_proposal_type_id(
                pt.id, include_withdrawn=False)
            c.num_proposals += len(stuff)
            setattr(c, '%s_collection' % pt.name, stuff)
        for aat in c.accommodation_assistance_types:
            stuff = Proposal.find_all_by_accommodation_assistance_type_id(
                aat.id)
            setattr(c, '%s_collection' % aat.name, stuff)
        for tat in c.travel_assistance_types:
            stuff = Proposal.find_all_by_travel_assistance_type_id(tat.id)
            setattr(c, '%s_collection' % tat.name, stuff)

        return render('proposal/list_review.mako')
Exemplo n.º 6
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')
Exemplo n.º 7
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')