Starts in:
2 DAYS
8 HRS
47 MIN
19 SEC
Starts in:
2 D
8 H
47 M
19 S
Open Closed

Issues / Questions about features #836


User avatar
0
scott7106 created

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, please use the search on the homepage.

  • ABP Framework version: v4.1.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): no

I am running into 2 issues which may be lack of knowledge.

  1. When I add the RequiresFeature to a method or app service class, I cannot figure out how to get the application tests to work. It fails with a permissions issue since the feature is not "enabled" for the test case. Trying to add programmatically enable the feature has not worked so far. Is there an example available for how to test a service which requires a feature?

  2. When a feature has permissions associated with it, how do I only show the permissions when it is enabled for a tenant? I added a feature check before adding the permissions in the Permission definition provider, but this causes errors if you log out of a tenant who has the feature and then log into a client which does have the feature. The call to AbpConfiguration is not reset and the permissions are not listed there. Is there an example available for how to correctly hide permissions behind a feature?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    how to test a service which requires a feature?

    You can mock the IFeatureStore service. (https://github.com/abpframework/abp/blob/dev/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/TestFeatureStore.cs#L9)

    When a feature has permissions associated with it, how do I only show the permissions when it is enabled for a tenant? I added a feature check before adding the permissions in the Permission definition provider, but this causes errors if you log out of a tenant who has the feature and then log into a client which does have the feature. The call to AbpConfiguration is not reset and the permissions are not listed there. Is there an example available for how to correctly hide permissions behind a feature

    I don't quite understand, Can you share some code?

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