Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def get_current_user_data(context_variable_key)

if context_variable_key.start_with?(USER_VALUE_TAG_PREFIX)
tag_key = context_variable_key[USER_VALUE_TAG_PREFIX.length..]
user[:tags].each do |tag|
return tag['value'] if tag['key'] == tag_key
end
tags = user[:tags]
return nil if tags.nil?

value = tags[tag_key] || tags[tag_key.to_sym]
return value
end

user[context_variable_key[USER_VALUE_PREFIX.length..].to_sym]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Utils
'lastName' => 'Doe',
'fullName' => 'John Doe',
'email' => 'john.doe@domain.com',
'tags' => [{ 'key' => 'planet', 'value' => 'Death Star' }],
'tags' => { 'planet' => 'Death Star' },
'roleId' => 1,
'permissionLevel' => 'admin'
}
Expand Down Expand Up @@ -89,7 +89,7 @@ module Utils
{ key: 'id', expected_value: user['id'] },
{ key: 'permissionLevel', expected_value: user['permissionLevel'] },
{ key: 'roleId', expected_value: user['roleId'] },
{ key: 'tags.planet', expected_value: user['tags'][0]['value'] },
{ key: 'tags.planet', expected_value: user['tags']['planet'] },
{ key: 'team.id', expected_value: team['id'] },
{ key: 'team.name', expected_value: team['name'] }
].each do |value|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Utils
lastName: 'Doe',
fullName: 'John Doe',
email: 'johndoe@forestadmin.com',
tags: [{ 'key' => 'foo', 'value' => 'bar' }],
tags: { 'foo' => 'bar' },
roleId: 1,
permissionLevel: 'admin'
}
Expand Down
Loading