def get_admin_map(event):
    roles_assigned = {}
    for delta in get_binding_deltas(event):
        if delta.get("action") == "ADD":
            roles_assigned[delta.get("member")] = delta.get("role")

    return roles_assigned
def get_event_type(event):
    # currently, only tracking a handful of event types
    for delta in get_binding_deltas(event):
        if delta["action"] == "ADD":
            if any((fnmatch(delta.get("role", ""), admin_role_pattern)
                    for admin_role_pattern in ADMIN_ROLES)):
                return event_type.ADMIN_ROLE_ASSIGNED

    return None
def rule(event):
    for delta in get_binding_deltas(event):
        if delta.get('action') != 'ADD':
            continue
        if any([
                fnmatch(delta.get('role', ''), admin_role_pattern)
                for admin_role_pattern in ADMIN_ROLES
        ]):
            return True
    return False
def get_event_type(event):
    # currently, only tracking a handful of event types
    for delta in get_binding_deltas(event):
        if delta['action'] == 'ADD':
            if any([
                    fnmatch(delta.get('role', ''), admin_role_pattern)
                    for admin_role_pattern in ADMIN_ROLES
            ]):
                return event_type.ADMIN_ROLE_ASSIGNED

    return None
Beispiel #5
0
def rule(event):
    for delta in get_binding_deltas(event):
        if delta.get("action") != "ADD":
            continue
        if any(
            (
                fnmatch(delta.get("role", ""), admin_role_pattern)
                for admin_role_pattern in ADMIN_ROLES
            )
        ):
            return True
    return False