1

as a part of this question . is there any way to Enable Features Dynamically ?

What I'm trying to achieve is the same exact concept of Permissions in Orchard . Except that instead of restricting the user from using this features, i don't want them to be displayed in the front-end.

this still can be achieved using custom permissions BUT the different which i mentioned in question which is answered by ViRuSTriNiTy , the permissions is not instantiated Immediately but it will be received from a third-part API on the IAuthorizationServiceEventHandler

    public void Complete(CheckAccessContext context)
    {
     /// get the permission for the current IUser via thirdpart API
     /// Enable/Disable features depending on the response
    } 

say i will be receiving a json response like this below :

[{ "Permission": "Home"  }, { "Permission": "Videos"  }]
ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58
buff
  • 331
  • 2
  • 13
  • Features are enables per tenant, very early. I don't think there's a way to enable or disable them per request or that late. Permissions seem to be the way to go for what you're trying to achieve. Asynchronicity shouldn't be an issue, especially with proper caching. – Bertrand Le Roy Jan 26 '18 at 21:52
  • @BertrandLeRoy permissions will restrict users without permissions to use them , but i want to disable the display not the functionality – buff Jan 30 '18 at 13:40
  • No, permissions are just something you can check, and you can do so anywhere. – Bertrand Le Roy Jan 30 '18 at 14:35

1 Answers1

1

You can use EnableFeatures() / DisableFeatures() of the IModuleService interface.

This might not work in handlers though, i never had a case where i needed to enable / disable a feature in a handler.

ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58