Open Closed

how to hide swagger endpoints by using feature management #6680


User avatar
0
ElifKaya created

Hi,

We removed some modules from feature management module. So, we don't see any pages or something of removed module on UI side. But, we can see removed module's endpoints on Swagger side. How can we manage swagger endpoints by using feature management? We want to manage this selection(hide/show module on swagger) from UI side with admin user.

Thanks,

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.3.1
  • UI Type: Angular / MVC
  • Database System: EF Core (SQL Server,)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

3 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, I created an article to show how to hide ABP related endpoints on Swagger UI by simply checking from the settings page. Your requirement is almost the same, so you can follow this article and update it according to your needs.

    Also, please notice if you want to hide ABP-related endpoints on Swagger UI on development time, you can use the built-in option: https://docs.abp.io/en/abp/latest/API/Swagger-Integration#hide-abp-endpoints-on-swagger-ui

  • User Avatar
    0
    ElifKaya created

    Hi, I created an article to show how to hide ABP related endpoints on Swagger UI by simply checking from the settings page. Your requirement is almost the same, so you can follow this article and update it according to your needs.

    Also, please notice if you want to hide ABP-related endpoints on Swagger UI on development time, you can use the built-in option: https://docs.abp.io/en/abp/latest/API/Swagger-Integration#hide-abp-endpoints-on-swagger-ui

    Thanks, I used this method to hide endpoints before. But, we want t o manage this option dynamically. For example, if admin user select some module from UI, then we want to show it on swagger. Otherwise, users should not see this module's endpoints Is it possible?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, I created an article to show how to hide ABP related endpoints on Swagger UI by simply checking from the settings page. Your requirement is almost the same, so you can follow this article and update it according to your needs.

    Also, please notice if you want to hide ABP-related endpoints on Swagger UI on development time, you can use the built-in option:
    https://docs.abp.io/en/abp/latest/API/Swagger-Integration#hide-abp-endpoints-on-swagger-ui

    Thanks, I used this method to hide endpoints before. But, we want t o manage this option dynamically. For example, if admin user select some module from UI, then we want to show it on swagger. Otherwise, users should not see this module's endpoints Is it possible?

    Yes, it's possible. You need to create a custom document filter, check if the related permission is granted, or check if the role is admin for example, and then provide the related endpoints that you want to show by filtering endpoints.

    But, as you would guess, this is a custom need and we are not providing a built-in option for that. So, you should create the document filter by yourself according to your needs.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11