Skip to content

Commit

Permalink
Fixed a crash where GroupRule recalculations assumed a Person object …
Browse files Browse the repository at this point in the history
…in some cases
  • Loading branch information
cthielen committed Feb 26, 2014
1 parent dbc55de commit a69b064
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions app/models/group_rule.rb
Expand Up @@ -91,16 +91,20 @@ def GroupRule.resolve_target!(column, entity_id)
end
end
when :ou
entity.groups.ous.each do |ou|
GroupRule.where(:column => "ou").each do |rule|
if rule.condition == "is"
if rule.value == ou.name
logger.info "Matched 'ou is' rule. Recording result."
rule.results << GroupRuleResult.new(:entity_id => entity_id)
touched_group_ids << rule.group.id
if entity.type == 'Group'
logger.warn "Targetted entity for 'Department is' rule is a group #{entity.log_identifier}. Skipping ..."
else
entity.groups.ous.each do |ou|
GroupRule.where(:column => "ou").each do |rule|
if rule.condition == "is"
if rule.value == ou.name
logger.info "Matched 'ou is' rule. Recording result."
rule.results << GroupRuleResult.new(:entity_id => entity_id)
touched_group_ids << rule.group.id
end
elsif rule.condition == "is not"
logger.warn "Cannot GroupRule.resolve_target! for 'ou is not'. Unimplemented behavior."
end
elsif rule.condition == "is not"
logger.warn "Cannot GroupRule.resolve_target! for 'ou is not'. Unimplemented behavior."
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/last_updated.rb
@@ -1 +1 @@
LAST_UPDATED = 'Tue Feb 25 14:55:09 PST 2014'
LAST_UPDATED = 'Tue Feb 25 16:36:25 PST 2014'

0 comments on commit a69b064

Please sign in to comment.