OrchardCoreContrib.Modules icon indicating copy to clipboard operation
OrchardCoreContrib.Modules copied to clipboard

Discussion: include "User" endpoints in the "Swagger Module"

Open MarGraz opened this issue 1 year ago • 8 comments

Hello,

following the discussion here, I'm interested in knowing if it's possible to include user endpoints in the "Swagger Module" to retrieve user information. I looked through "OrchardCore.Users" but couldn't find any ApiController for this purpose. Should I create a custom controller?

Additionally, I tried using GraphQL and have opened a discussion here.

Thank you

MarGraz avatar Feb 26 '24 17:02 MarGraz

I looked through "OrchardCore.Users" but couldn't find any ApiController for this purpose. Should I create a custom controller?

I think you need to expose it via ApiController, please let me know what kind of information that you need to expose, maybe we can add it in OCC if it's not accepted in OC

hishamco avatar Feb 27 '24 14:02 hishamco

@hishamco thank you for your reply.

I want to expose some properties from this User model, like: Username, Email, IsEnabled, IsLockoutEnabled, RoleNames. I want to use it in a Orchard Core "Workflow".

I need also to add some custom properties, but first I need to check how to extend the User model to do this.

Thank you

MarGraz avatar Feb 27 '24 16:02 MarGraz

As you know the user information is sensitive, but you can add your API controller that accesses the underlying OC.Users APIs to achieve that

hishamco avatar Feb 27 '24 16:02 hishamco

Yes I know, but I want to use it in a "Workflow", and I'm still not able to do it creating a "Query" (here the discussion), so I think the only way is to create a custom API controller.

MarGraz avatar Feb 27 '24 16:02 MarGraz

@hishamco, Piedone replied to me here, confirming that it's possible to perform queries against the UserIndex table. This means I can use the saved query in the "Workflow".

Thank you

MarGraz avatar Feb 28 '24 09:02 MarGraz

@MarGraz seems your last question about the query not the Swagger which might confuse me & Zoltan to come back and forth between the two repos :)

Please wait for the reply there, and let me know if you need any help regarding the swagger module

hishamco avatar Feb 28 '24 16:02 hishamco

Oh, I'm sorry 😟

I believe Zoltan's response is fine. Of course, if I need to expose a User API endpoint, I will create a custom API controller and follow your readme to include it in the Swagger.

Thank you

MarGraz avatar Feb 28 '24 16:02 MarGraz

In case the API Controller is not approved in OC and we find it's useful we can add it in OCC.Users module

hishamco avatar Feb 28 '24 16:02 hishamco