-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make OC.Features optional to non-default tenant #12950
Make OC.Features optional to non-default tenant #12950
Conversation
More on this. I think we should stop using the ShellSettings.IsDefaultShell() and rely on a TenantId with a feature that says that this specific tenant is a tenant management one. Hence why I started a PR that introduces a TenantId. |
@Skrypt this PR isn't using |
Migration documentation: modules that use the recipe migrations need to depend on |
I tagged it as For example in a manifest we can't have a dependency on a core project which is not a module. I can't right now but I'll try to review it this night |
@jtkech we'll await your approval before we merge it. The only reason we can list
|
Ah okay, I will look at it this night. Hmm but looks wrong that |
@jtkech it looks wrong because it is wrong. nice catch... I was just testing you ;) I also added the documentation for the 1.6 release as @sebastienros requested. |
Okay cool !!! |
@jtkech were you able to valid this PR? |
@MikeAlhayek Oops sorry, no problem I will look at it this night. |
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Recipes.Core/ServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
@jtkech I made some updates as per your request. If you are good with it, either merge or approve please. |
src/OrchardCore.Modules/OrchardCore.Features/Views/Admin/Features.cshtml
Outdated
Show resolved
Hide resolved
@MikeAlhayek Okay, just did an additional little review. As said in the review, in fact the related modules using the recipe migrator were already missing a dependency on OC.Recipes, and seems to not be related to this PR, not saying that it is not good to be fixed here but just to well understand the goal of this PR. So, even if core modules is a good idea (we may need to discuss a little more on it), for the goal of this PR it seems that we only need to remove Then we would just need to add or not Note: Never tried so not sure but maybe we can also use Feature Profiles to filter So in summary, unless some tweaks as missing null checks, maybe this PR only needs to remove one line, the dependency of Hmm, the above assuming that we don't change the behavior of Yes because, even if here we keep the same behavior for the Default tenant, not sure it's good that this is no more the case for the other tenants, It may be unexpected that we now can disable |
@jtkech I think I went down the path of making Recipes.Core because a service depends on recipes that isn't available unless Features in enabled. I don't recall the exact service name now. Either way, I don't think there is a good reason to undo some of these good changes that already implemented in this PR. With this PR, we can even make Recipes not always enabled if we want to hide the UI. In theory, everything should still work, as long as everything that needs core recipe services depends on the new core feature. I'll get the other changes done in the morning. |
@sebastienros I made the requested change here. The only issue I am seeing from a UI perspective here, if a site admin disable their own Features module, they'll get a 404 on the redirect. So instead of the 404, I redirect the user to the dashboard if they disabled their own features UI. @jtkech Are you good with this PR or do you have any change to add? |
@MikeAlhayek Okay no problem but there is still something that I don't understand. So now if a non I would have made another distinction in the view model, not only to know if this is the Then if not managed by itself for now it means that it is by the |
@jtkech Thanks for your feedback.
Yes this is allowed as per @sebastienros request. He said if they disable their own
This is the exact behavior we have. Maybe we should rename the new
Now sure that I understand. In the controller we check to see if the current tenant can disable the feature. |
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
Okay I'm not against but this is to prevent this "issue" that we made this feature Easy to keep the
Note: For now Manager != Managed => Manager is the Default tenant, so the above 2nd condition could be resumed to Manager != Managed. |
@jtkech Yes I do not disagree with you. This is what I had done. So basically Features will be always enabled for tenants once enabled. Only Default tenant will be able to disable it using the Features UI. If you watch the recording for last meeting on Tuesday, you’ll see his remarks. The only issue with allowing the tenant to disable their own Features tenant, is that they can’t enable it again from the UI. They will be able to enable it via recipes is the deployment feature is enabled. Either way, let us know what do you recommend to do here and we can discuss with your feedback with @sebastienros |
Okay then, as said I'm open to any suggestion, just to be sure there was no confusion. otherwise I would recommend to keep the previous behavior and only allow the Default tenant to make new things needed in this PR. Hmm maybe @sebastienros doesn't want a feature which is no more Hmm, maybe better to keep |
@sebastienros thoughts here? It sounds like your thoughts are the opposite of what is @jtkech is suggesting here. We just need a way to be able to disable Features for tenants. |
src/OrchardCore.Modules/OrchardCore.Features/Controllers/AdminController.cs
Outdated
Show resolved
Hide resolved
Just saw the last meeting, yes we can set a feature as It is only used by the UI and not managed by the infrastructure, so yes I think we can disable it through a recipe, but it was introduced to prevent people from breaking their tenant/site from the UI. For info we also have And the So the goal (not saying it is good) was to keep the same I'm not against anything but maybe keep the exact same behavior as before and then just allow the Default tenant to disable Hmm, IMHO I think it is better to keep Edited: Yes in place of removing |
Yes during the meeting @sebastienros was saying that it is not good to manage differently a given feature as So we just need a confirmation, maybe he was not remembering about the Anyway, as done currently where So my recommendation is to keep |
I think we can safely re-use If @sebastienros really wanted to change this existing behavior, will be easy to tweak again. Then only allow the new behavior (the disable button) for the Default tenant when it manages another tenant, easy to add this state to the model, as I remember by checking if the shellSettings are different. Then I will let you re-tried it a little, then I will approve and merge. |
@jtkech so to ensure I understand the request, you want to remove the IsAlwaysEnabled on the feature. However, a tenant should not be able to disable it on their own from their UI. A default tenant will still be able to enable/disable the feature for any other tenant. Correct? I'll try work on this tomorrow. |
No, you already removed
Yes the goal will be to preserve this desired behavior, we will just have to change the view model state we pass to the view that will check it to allow the Disable button, this in a simpler way than before I think. |
If we set the IsAlwaysEnabled back to true, I don't think the default tenant will be able to disable the feature. I'll try it |
Do you mean it is not only checked by the UI? Let me check it. It seems that |
@jtkech you are right.
I tested this out and all seems to be doing exactly what we want. Feel free to Merge or at least approve it and I'll merge it. |
Fix #12723