Skip to content

Expose enterprise group attributes in the users API

sameer shaik requested to merge enterprise-api into master

What does this MR do and why?

Recently, we introduced attributes specific to enterprise users. This merge request (MR) includes a minor modification to the admin-specific entity related to the users API, incorporating these enterprise attributes.

Additionally, we're preloading the user_detail attributes in the users API method. This enhancement is aimed at improving performance. When admins use the /users endpoint, the operation will be more efficient due to this preloading.

How to set up and validate locally

Select any user and manually update the enterprise attributes (enterprise_group_id, enterprise_group_associated_at) using the console:

user= User.find(5)
user.user_detail.update(enterprise_group_id: 33, enterprise_group_associated_at: Time.now)

Use the API endpoint api/v4/users/ID. You will observe that the response now includes the enterprise attributes.

Screenshots or screen recordings

Example:

http://localhost:3000/api/v4/users/5

{"id":5,"username":"arnetta","name":"Cameron 
"enterprise_group_id":35,
"enterprise_group_associated_at":"2023-07-05T11:23:59.042Z",
"trial":false}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by sameer shaik

Merge request reports

Loading