def _process(self): event_principal_query = (EventPrincipal.query.with_parent(self.event) .filter(EventPrincipal.type == PrincipalType.email, EventPrincipal.has_management_permission('submit'))) contrib_principal_query = (ContributionPrincipal.find(Contribution.event == self.event, ContributionPrincipal.type == PrincipalType.email, ContributionPrincipal.has_management_permission('submit')) .join(Contribution) .options(contains_eager('contribution'))) session_principal_query = (SessionPrincipal.find(Session.event == self.event, SessionPrincipal.type == PrincipalType.email, SessionPrincipal.has_management_permission()) .join(Session).options(joinedload('session').joinedload('acl_entries'))) persons = self.get_persons() person_list = sorted(persons.viewvalues(), key=lambda x: x['person'].display_full_name.lower()) num_no_account = 0 for principal in itertools.chain(event_principal_query, contrib_principal_query, session_principal_query): if principal.email not in persons: continue if not persons[principal.email].get('no_account'): persons[principal.email]['roles']['no_account'] = True num_no_account += 1 custom_roles = {'custom_{}'.format(r.id): {'name': r.name, 'code': r.code, 'color': r.color} for r in self.event.roles} return WPManagePersons.render_template('management/person_list.html', self.event, persons=person_list, num_no_account=num_no_account, builtin_roles=BUILTIN_ROLES, custom_roles=custom_roles)
def _process(self): event_principal_query = (EventPrincipal.query.with_parent(self.event) .filter(EventPrincipal.type == PrincipalType.email, EventPrincipal.has_management_permission('submit'))) contrib_principal_query = (ContributionPrincipal.find(Contribution.event == self.event, ContributionPrincipal.type == PrincipalType.email, ContributionPrincipal.has_management_permission('submit')) .join(Contribution) .options(contains_eager('contribution'))) session_principal_query = (SessionPrincipal.find(Session.event == self.event, SessionPrincipal.type == PrincipalType.email, SessionPrincipal.has_management_permission()) .join(Session).options(joinedload('session').joinedload('acl_entries'))) persons = self.get_persons() person_list = sorted(persons.values(), key=lambda x: x['person'].display_full_name.lower()) num_no_account = 0 for principal in itertools.chain(event_principal_query, contrib_principal_query, session_principal_query): if principal.email not in persons: continue if not persons[principal.email].get('no_account'): persons[principal.email]['roles']['no_account'] = True num_no_account += 1 custom_roles = {f'custom_{r.id}': {'name': r.name, 'code': r.code, 'color': r.color} for r in self.event.roles} return WPManagePersons.render_template('management/person_list.html', self.event, persons=person_list, num_no_account=num_no_account, builtin_roles=BUILTIN_ROLES, custom_roles=custom_roles)
def _query_contributions_with_user_paper_submission_rights(event, user): criteria = [ Contribution.abstract.has(Abstract.submitter_id == user.id), Contribution.acl_entries.any( db.and_(ContributionPrincipal.user == user, ContributionPrincipal.has_management_permission('submit'))) ] return Contribution.query.with_parent(event).filter(db.or_(*criteria))
def _query_contributions_with_user_as_submitter(event, user): return (Contribution.query.with_parent(event).filter( Contribution.acl_entries.any( db.and_(ContributionPrincipal.has_management_permission('submit'), ContributionPrincipal.user == user))))
def _query_contributions_with_user_as_submitter(event, user): return (Contribution.query.with_parent(event) .filter(Contribution.acl_entries.any(db.and_(ContributionPrincipal.has_management_permission('submit'), ContributionPrincipal.user == user))))