コード例 #1
0
def update_initial_issue(obj, issue_tracker_params):
    """Updates initial object according to business requirements"""
    issue_tracker_status = issue_tracker_params.status.lower()
    ggrc_status = ISSUE_STATUS_MAPPING.get(issue_tracker_status)
    if ggrc_status:
        obj.status = ggrc_status

    issue_admins = [p.email for p in obj.get_persons_for_rolename("Admin")]
    issue_primary_contacts = [
        p.email for p in obj.get_persons_for_rolename("Primary Contacts")
    ]
    issue_secondary_contacts = [
        p.email for p in obj.get_persons_for_rolename("Secondary Contacts")
    ]

    verifier_email = issue_tracker_params.verifier
    if verifier_email and verifier_email not in issue_admins:
        create_missed_issue_acl(verifier_email, "Admin", obj)

    assignee_email = issue_tracker_params.assignee
    if assignee_email and assignee_email not in issue_primary_contacts:
        create_missed_issue_acl(assignee_email, "Primary Contacts", obj)

    for secondary_contact in issue_tracker_params.cc_list:
        if secondary_contact not in issue_secondary_contacts:
            create_missed_issue_acl(secondary_contact, "Secondary Contacts",
                                    obj)
コード例 #2
0
ファイル: issue_integration.py プロジェクト: google/ggrc-core
def update_initial_issue(obj, issue_tracker_params):
  """Updates initial object according to business requirements"""
  issue_tracker_status = issue_tracker_params.status.lower()
  ggrc_status = ISSUE_STATUS_MAPPING.get(issue_tracker_status)
  if ggrc_status:
    obj.status = ggrc_status

  issue_admins = [p.email for p in obj.get_persons_for_rolename("Admin")]
  issue_primary_contacts = [
      p.email for p in obj.get_persons_for_rolename("Primary Contacts")
  ]
  issue_secondary_contacts = [
      p.email for p in obj.get_persons_for_rolename("Secondary Contacts")
  ]

  verifier_email = issue_tracker_params.verifier
  if verifier_email and verifier_email not in issue_admins:
    create_missed_issue_acl(verifier_email, "Admin", obj)

  assignee_email = issue_tracker_params.assignee
  if assignee_email and assignee_email not in issue_primary_contacts:
    create_missed_issue_acl(assignee_email, "Primary Contacts", obj)

  for secondary_contact in issue_tracker_params.cc_list:
    if secondary_contact not in issue_secondary_contacts:
      create_missed_issue_acl(secondary_contact, "Secondary Contacts", obj)