OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

Unable to disable a feature when it depends on a feature that is always enabled.

Open MikeAlhayek opened this issue 1 year ago • 3 comments

Describe the bug

Let's say you have "A" Module and it depends on "B" module, where module "A" is configured to "IsAlwaysEnabled" and module "B" is NOT always enabled. Attempting to disable module "B" should not be allowed "and it isn't allowed". However, when you attempt to disable module "B" you get a success error B was disabled. But it would still be enabled.

To Reproduce

Steps to reproduce the behavior:

  1. Create module A
  2. Create module B and make it always enabled. Module B should depend on module A
  3. attempt to disable module A
  4. You'll see success message A was disabled. but if you search again for module "A" you'll noticed that it's still enabled.

Expected behavior

I would expect to see a warning or error that say "module A was not disabled because module B depends on it". Better yet, maybe we should treat module A as always enabled since at least one of it's dependent is configured to always be enabled.

Screenshots

team-disable-example

MikeAlhayek avatar Aug 16 '22 14:08 MikeAlhayek

Thanks for reproting this, possible solutions is to avoid disable the module, or exclude those who marked as always enabled

I might submit a PR to fix this

hishamco avatar Aug 16 '22 18:08 hishamco

or exclude those who marked as always enabled

Already done I think but we also need to check its dependents (not dependencies) to see if one is AlwaysEnabled AND already Enabled

Note: Already checked somewhere because at the end we don't disable the feature

jtkech avatar Aug 16 '22 19:08 jtkech

Does we check all the dependency hierarchy?

hishamco avatar Aug 18 '22 19:08 hishamco