-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return miq_groups on api entrypoint #84
Return miq_groups on api entrypoint #84
Conversation
spec/requests/authentication_spec.rb
Outdated
"identity" => hash_including("miq_groups" => a_collection_including( | ||
hash_including("href" => api_users_url(nil, @user.miq_groups.first)) | ||
)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the miq_groups in identity is returned with all calls (i.e. without attributes=authorization), in which case if you can update the description and move the test here to the regular entrypoint (not authorization).
spec/requests/authentication_spec.rb
Outdated
@@ -104,7 +104,10 @@ | |||
"group_href" => "/api/groups/#{group2.id}", | |||
"role" => @role.name, | |||
"role_href" => "/api/roles/#{group2.miq_user_role.id}", | |||
"tenant" => @group.tenant.name | |||
"tenant" => @group.tenant.name, | |||
"miq_groups" => a_collection_including( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jntullo for the update. Maybe we should also add the groups => [ ] here before miq_groups for completion. It may never have been added to the spec.
Checked commit jntullo@5b5cad8 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
def normalize_array(obj) | ||
type = @req.subject | ||
def normalize_array(obj, type = nil) | ||
type ||= @req.subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid to ask: why was this needed, what is @req.subject in the case of entrypoint, who calls it with that second argument ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abellotti I used this for rendering the miq_groups
properly, and since the /api
endpoint doesn't have the groups
subject, I pass in the :groups parameter
LGTM!! Thanks @jntullo for the enhancement. |
O frabjous day! Callooh! Callay! |
Resolves #74
This enhancement returns
miq_groups
on the entrypoint@miq-bot add_label enhancement
@miq-bot assign @abellotti
cc: @AllenBW