def rule(event):
    if event.get("source_type") == "user" and event.get("action") == "update":
        # admin roles have their own handling
        if event.udm("event_type") != event_type.ADMIN_ROLE_ASSIGNED:
            _, new_role = zendesk_get_roles(event)
            return bool(new_role)
    return False
Beispiel #2
0
def get_user_event_type(event):
    # check for login events
    if event.get("action") == "login":
        if event.get(ZENDESK_CHANGE_DESCRIPTION, "").lower().startswith("successful sign-in"):
            return event_type.SUCCESSFUL_LOGIN
    # check for admin assignment
    if event.get("action") == "update":
        _, new_role = zendesk_get_roles(event)
        if new_role and is_admin_role(new_role):
            return event_type.ADMIN_ROLE_ASSIGNED
    return None
Beispiel #3
0
def get_assigned_admin_role(event):
    _, new_role = zendesk_get_roles(event)
    if is_admin_role(new_role):
        return new_role
    return None
def title(event):
    old_role, new_role = zendesk_get_roles(event)
    return (
        f"Actor user [{event.udm('actor_user')}] changed [{event.udm('user')}] role from "
        f"{old_role} to {new_role}"
    )