Esempio n. 1
0
def update_team_members(event,
                        managers,
                        judges,
                        content_reviewers=None,
                        layout_reviewers=None):
    updated = {}
    update_object_principals(event, managers, permission='paper_manager')
    updated[PaperReviewingRole.judge] = update_object_principals(
        event, judges, permission='paper_judge')
    if content_reviewers is not None:
        updated[
            PaperReviewingRole.content_reviewer] = update_object_principals(
                event, content_reviewers, permission='paper_content_reviewer')
    if layout_reviewers is not None:
        updated[PaperReviewingRole.layout_reviewer] = update_object_principals(
            event, layout_reviewers, permission='paper_layout_reviewer')
    unassigned_contribs = _unassign_removed(event, updated)
    roles_to_notify = paper_reviewing_settings.get(event,
                                                   'notify_on_added_to_event')
    for role, changes in updated.items():
        if role not in roles_to_notify:
            continue
        for user in changes['added']:
            notify_added_to_reviewing_team(user, role, event)
        for user in changes['removed']:
            notify_removed_from_reviewing_team(user, role, event)

    logger.info("Paper teams of %r updated by %r", event, session.user)
    return unassigned_contribs
Esempio n. 2
0
def update_team_members(event, managers, judges, content_reviewers=None, layout_reviewers=None):
    updated = {}
    update_object_principals(event, managers, permission='paper_manager')
    updated[PaperReviewingRole.judge] = update_object_principals(event, judges, permission='paper_judge')
    if content_reviewers is not None:
        updated[PaperReviewingRole.content_reviewer] = update_object_principals(event, content_reviewers,
                                                                                permission='paper_content_reviewer')
    if layout_reviewers is not None:
        updated[PaperReviewingRole.layout_reviewer] = update_object_principals(event, layout_reviewers,
                                                                               permission='paper_layout_reviewer')
    unassigned_contribs = _unassign_removed(event, updated)
    roles_to_notify = paper_reviewing_settings.get(event, 'notify_on_added_to_event')
    if PaperReviewingRole.judge in roles_to_notify:
        for judge in updated[PaperReviewingRole.judge]['added']:
            notify_added_to_reviewing_team(judge, PaperReviewingRole.judge, event)
        for judge in updated[PaperReviewingRole.judge]['removed']:
            notify_removed_from_reviewing_team(judge, PaperReviewingRole.judge, event)
    if PaperReviewingRole.content_reviewer in roles_to_notify:
        for reviewer in updated[PaperReviewingRole.content_reviewer]['added']:
            notify_added_to_reviewing_team(reviewer, PaperReviewingRole.content_reviewer, event)
        for reviewer in updated[PaperReviewingRole.content_reviewer]['removed']:
            notify_removed_from_reviewing_team(reviewer, PaperReviewingRole.content_reviewer, event)
    if PaperReviewingRole.layout_reviewer in roles_to_notify:
        for reviewer in updated[PaperReviewingRole.layout_reviewer]['added']:
            notify_added_to_reviewing_team(reviewer, PaperReviewingRole.layout_reviewer, event)
        for reviewer in updated[PaperReviewingRole.layout_reviewer]['removed']:
            notify_removed_from_reviewing_team(reviewer, PaperReviewingRole.layout_reviewer, event)
    logger.info("Paper teams of %r updated by %r", event, session.user)
    return unassigned_contribs