Skip to content
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

Merged
merged 1 commit into from
Sep 27, 2017
Merged

Return miq_groups on api entrypoint #84

merged 1 commit into from
Sep 27, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Sep 27, 2017

Resolves #74

This enhancement returns miq_groups on the entrypoint

GET /api
{
   "name": "API",
   "description": "REST API",
   "settings": {...},
   "identity": {
      ...
      "groups" [...],
      "miq_groups": [
         { "href": "/api/groups/:id", "id": ":id" ... } ...
      ]
   }
   ...
}

@miq-bot add_label enhancement
@miq-bot assign @abellotti
cc: @AllenBW

"identity" => hash_including("miq_groups" => a_collection_including(
hash_including("href" => api_users_url(nil, @user.miq_groups.first))
))
}
Copy link
Member

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).

@@ -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(
Copy link
Member

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.

@miq-bot
Copy link
Member

miq-bot commented Sep 27, 2017

Checked commit jntullo@5b5cad8 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks fine. 🏆

def normalize_array(obj)
type = @req.subject
def normalize_array(obj, type = nil)
type ||= @req.subject
Copy link
Member

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 ?

Copy link
Author

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

@abellotti abellotti added this to the Sprint 70 Ending Oct 2, 2017 milestone Sep 27, 2017
@abellotti
Copy link
Member

LGTM!! Thanks @jntullo for the enhancement.

@abellotti abellotti merged commit 4231990 into ManageIQ:master Sep 27, 2017
@AllenBW
Copy link
Member

AllenBW commented Sep 27, 2017

O frabjous day! Callooh! Callay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants