예제 #1
0
파일: role.py 프로젝트: CarlFK/zookeepr
    def edit(self, id):
        c.form = 'edit'
        c.role = Role.find_by_id(id)
        
        defaults = h.object_to_defaults(c.role, 'role')

        form = render('/role/edit.mako')
        return htmlfill.render(form, defaults)
예제 #2
0
파일: role.py 프로젝트: CarlFK/zookeepr
    def delete(self, id):
        """Delete the role

        GET will return a form asking for approval.

        POST requests will delete the item.
        """
        c.role = Role.find_by_id(id)
        return render('role/confirm_delete.mako')
예제 #3
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
예제 #4
0
파일: funding.py 프로젝트: CarlFK/zookeepr
    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')
예제 #5
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')
예제 #6
0
파일: role.py 프로젝트: CarlFK/zookeepr
    def _edit(self, id):
        c.role = Role.find_by_id(id)

        for key in self.form_result['role']:
            setattr(c.role, key, self.form_result['role'][key])

        if c.role.pretty_name is not None and c.role.pretty_name == '':
            setattr(c.role, 'pretty_name', None)

        # update the objects with the validated form data
        meta.Session.commit()

        redirect_to(action='view', id=id)
예제 #7
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')
예제 #8
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')
예제 #9
0
파일: proposal.py 프로젝트: CarlFK/zookeepr
    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')
예제 #10
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')
예제 #11
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')
예제 #12
0
파일: role.py 프로젝트: CarlFK/zookeepr
    def view(self, id):
        c.registration_status = h.config['app_conf'].get('registration_status')
        c.role = Role.find_by_id(id)

        return render('role/view.mako')
예제 #13
0
파일: role.py 프로젝트: CarlFK/zookeepr
 def index(self):
     c.role_collection = Role.find_all()
     return render('/role/list.mako')
예제 #14
0
파일: role.py 프로젝트: CarlFK/zookeepr
    def _delete(self, id):
        c.role = Role.find_by_id(id)
        meta.Session.delete(c.role)
        meta.Session.commit()

        redirect_to('index')
예제 #15
0
    def roles(self, id):

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