Skip to content

Commit

Permalink
Move TopLevelOU comments for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
adhilto committed Jan 15, 2024
1 parent 86efcf5 commit ce94b7d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions rego/Utils.rego
Original file line number Diff line number Diff line change
Expand Up @@ -43,40 +43,40 @@ OUsWithEvents contains OrgUnit if {
OrgUnit := Parameter.value
}

# Simplest case: if input.tenant_info.topLevelOU is
# non-empty, it contains the name of the top-level OU.
TopLevelOU := Name if {
# Simplest case: if input.tenant_info.topLevelOU is
# non-empty, it contains the name of the top-level OU.
input.tenant_info.topLevelOU != ""
Name := input.tenant_info.topLevelOU
}

# input.tenant_info.topLevelOU will be empty when
# no custom OUs have been created, as in this case
# the top-level OU cannot be determined via the API.
# Fortunately, in this case, we know there's literally
# only one OU, so we can grab the OU listed on any of
# the events and know that it is the top-level OU
TopLevelOU := OU if {
# input.tenant_info.topLevelOU will be empty when
# no custom OUs have been created, as in this case
# the top-level OU cannot be determined via the API.
# Fortunately, in this case, we know there's literally
# only one OU, so we can grab the OU listed on any of
# the events and know that it is the top-level OU
input.tenant_info.topLevelOU == ""
count(OUsWithEvents) == 1
some OU in OUsWithEvents
}

# Extreme edge case: input.tenant_info.topLevelOU is empty
# because no custom OUs currently exist, but multiple OUs
# are present in the events, likely due to an custom OU
# that was deleted. In this case, we have no way of determining
# which of OUs is the current OU.
TopLevelOU := Name if {
# Extreme edge case: input.tenant_info.topLevelOU is empty
# because no custom OUs currently exist, but multiple OUs
# are present in the events, likely due to an custom OU
# that was deleted. In this case, we have no way of determining
# which of OUs is the current OU.
input.tenant_info.topLevelOU == ""
count(OUsWithEvents) > 1
Name := ""
}

# Extreme edge case: no custom OUs have been made
# and the logs are empty. In this case, we really
# have no way of determining the top-level OU name.
TopLevelOU := Name if {
# Extreme edge case: no custom OUs have been made
# and the logs are empty. In this case, we really
# have no way of determining the top-level OU name.
input.tenant_info.topLevelOU == ""
count(OUsWithEvents) == 0
Name := ""
Expand Down

0 comments on commit ce94b7d

Please sign in to comment.