Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/entitlements/data/groups/calculated/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def parsed_data
result[key]["&="] ||= []

# Semicolon predicates
if key == "description"
if key == "description" || key.start_with?("metadata_")
result[key][operator] << { key: val }
else
result[key][operator] << parsed_predicate(val)
Comment on lines +297 to 300
Expand Down
9 changes: 5 additions & 4 deletions spec/unit/entitlements/data/groups/calculated/text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,11 @@
expect(subject.metadata).to eq("kittens" => "awesome", "puppies" => "young dogs")
end

it "raises an error if expiration is given to metadata" do
filename = fixture("ldap-config/metadata/expiration.txt")
message = "In #{filename}, the key metadata_kittens cannot have additional setting(s) \"expiration\"!"
expect { described_class.new(filename: filename) }.to raise_error(message)
it "does not raise an error when metadata values contain semicolons" do
filename = fixture("ldap-config/metadata/semicolon.txt")
expect { described_class.new(filename: filename) }.not_to raise_error
subject = described_class.new(filename: filename)
Comment on lines +188 to +189
expect(subject.metadata).to eq("kittens" => "awesome", "justification" => "Need access; for project work")
end
end

Expand Down
5 changes: 5 additions & 0 deletions spec/unit/fixtures/ldap-config/metadata/semicolon.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description = Lots of metadata here
username = BlackManx
username = RAGAMUFFIn
metadata_kittens = awesome
metadata_justification = Need access; for project work
Loading