Skip to content
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

OrchardCore.Cors #2682

Merged
merged 21 commits into from
Dec 27, 2020
Merged

OrchardCore.Cors #2682

merged 21 commits into from
Dec 27, 2020

Conversation

MatthijsKrempel
Copy link
Contributor

@MatthijsKrempel MatthijsKrempel commented Nov 14, 2018

Cors module
Fixes #2680

Feedback is welcome

@sebastienros
Copy link
Member

/cc @petedavis @jrestall @PinpointTownes @rserj

Feel free to criticize as much as you want, I didn't write it 😄

jrestall
jrestall previously approved these changes Nov 16, 2018
Copy link
Contributor

@jrestall jrestall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes, module looks great and will be very useful!

@Skrypt
Copy link
Contributor

Skrypt commented Nov 20, 2018

I'm going to test this branch ; I want to see how the UI/data is working 😉

Copy link
Contributor

@Skrypt Skrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI should be changed in favor of using a sortable to reorder each policy. Each sortable element should be containing the form elements to edit each policy. The "Add policy button" would need to be set underneath that sortable list just like we did with the Predefined List Vue.js component for Text fields. We also could add a radio button to be able to select the default policy to make it more evident than just using the first policy in that list by default (optional). Also, each sortable elements could be collapsible so that we can just see a list of policies by name and if we need to edit it we could expand it to see the actual form details. Also optionally, we could have a "edit data" icon set on top of that list to be able to actually just manually edit/copy/paste the json data and also to be able to change the default policy by typing it's name.

@jtkech
Copy link
Member

jtkech commented Dec 7, 2018

@Skrypt @MatthijsKrempel

For infos about the distributed cache, based on what i'm working on in the distributed branch.

  • Currently IDistributedCache is mainly used with ITagCache so that when a tag is invalidated the related cache entries are invalidated. We will have distributed implementations based on redis for both IDistributedCache and ITagCache, but currently this pattern is mainly used for rendering.

  • Another pattern is to use IMemoryCache and ISignal whose implementation will be distributed so that when a signal token has changed local caches are invalidated. Some services, e.g TemplateManager, use this pattern that we adapted (see the distributed branch) by using signal tokens for cache entries.

  • Finally, for settings many times we use a warning message saying that the tenant will be restarted on saving, and when updating the settings we restart the tenant. And, because we will have a feature to sync tenants / shells states in a distributed system, this is another way to sync data among instances.

So here, for the settings driver, if possible maybe better to use the last pattern.

@Skrypt
Copy link
Contributor

Skrypt commented Dec 7, 2018

So remove the IMemoryCache and rework when the warning message displays.

@jtkech
Copy link
Member

jtkech commented Dec 7, 2018

My suggestion is to do, if possible, as in some other drivers e.g OpenIdValidationSettingsDisplayDriver.

Which uses the following warning in the edit view.

<p class="alert alert-warning">@T["The current tenant will be reloaded when the settings are saved."]</p>

And force the reloading when updating by doing something like this.

            // If the settings are valid, reload the current tenant.
            if (context.Updater.ModelState.IsValid)
            {
                await _shellHost.ReloadShellContextAsync(_shellSettings);
            }

Same suggestion for the Https and ReverseProxy modules.

@MatthijsKrempel
Copy link
Contributor Author

Sorry for the lack of updates, been really swamped the last couple of months.

Going to pick this up as soon as I get some time.

@agriffard
Copy link
Member

Can you please resolve the conflicts ?

@MatthijsKrempel
Copy link
Contributor Author

@agriffard will do, have to upgrade the UI as well.

Matthijs Krempel added 3 commits December 24, 2019 10:03
# Conflicts:
#	OrchardCore.sln
#	src/OrchardCore/OrchardCore.Application.Cms.Targets/OrchardCore.Application.Cms.Targets.csproj
@MatthijsKrempel
Copy link
Contributor Author

@agriffard done ;)

@jrestall jrestall dismissed their stale review December 26, 2019 10:36

Out of date.

@scleaver
Copy link
Contributor

Yeah... it threw me cause I felt like the first save should have been enough and then I moved onto another screen which of course meant my policy was not there when I went back.

@scleaver
Copy link
Contributor

@MatthijsKrempel - I think you should add policies the same way you add steps to deployment plans. Once you add and save a step you don't have to click save on the deployment plan separately to have the step saved to the plan. Just a thought.

@rserj
Copy link
Contributor

rserj commented Dec 4, 2020

Hello all, any updates on this PR?

@agriffard agriffard requested a review from Skrypt December 7, 2020 12:24
@agriffard
Copy link
Member

Please merge dev and put the title into the Title zone.

@agriffard agriffard requested a review from jptissot December 20, 2020 15:43
@agriffard
Copy link
Member

@MatthijsKrempel Can you please merge dev and finalize the PR?

@agriffard agriffard requested a review from jtkech December 23, 2020 17:54
Copy link
Member

@jtkech jtkech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jtkech
Copy link
Member

jtkech commented Dec 23, 2020

@agriffard I did a review, LGTM

But maybe need a review by others for the UI part as many changes were done around UI design

@Skrypt
Copy link
Contributor

Skrypt commented Dec 23, 2020

If it works. UI can wait. If I remember, there's a lot in this PR about UI that could be done.
Can't block it because of it.

@agriffard agriffard merged commit de5a011 into OrchardCMS:dev Dec 27, 2020
@MatthijsKrempel
Copy link
Contributor Author

MatthijsKrempel commented Dec 29, 2020 via email

<script asp-src="https://vuejs.org/js/vue.min.js" debug-src="https://vuejs.org/js/vue.js" asp-name="vuejs" at="Foot" depends-on="jQuery"></script>
<script depends-on="vuejs" asp-src="~/OrchardCore.Cors/Scripts/cors-admin.min.js" debug-src="~/OrchardCore.Cors/Scripts/cors-admin.js" type="text/javascript" asp-name="cors-admin" at="Foot"></script>
<script depends-on="cors-admin" at="Foot">
corsApp.policies = @Html.Raw(Json.Serialize(Model.Policies, settings));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ue data- attribute to pass the value

@MatthijsKrempel
Copy link
Contributor Author

MatthijsKrempel commented Dec 29, 2020 via email

@agriffard agriffard mentioned this pull request Dec 31, 2020
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Navigation.Core\OrchardCore.Navigation.Core.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Admin.Abstractions\OrchardCore.Admin.Abstractions.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.DisplayManagement\OrchardCore.DisplayManagement.csproj" />
<ProjectReference Include="..\..\OrchardCore\OrchardCore.Users.Core\OrchardCore.Users.Core.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing reference to OrchardCore.ResourceManagement busted in production as it won't find the Taghelpers. Easy to fix @scleaver

@@ -352,6 +353,7 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Contents.TagHelpers", "src\OrchardCore\OrchardCore.Contents.TagHelpers\OrchardCore.Contents.TagHelpers.csproj", "{6236734E-507B-461B-8E92-068886058E84}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OrchardCore.Search.Abstractions", "src\OrchardCore\OrchardCore.Search.Abstractions\OrchardCore.Search.Abstractions.csproj", "{5283A8BC-DFF4-436D-AA9C-EE2DBFC5D51A}"
>>>>>>> dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah no one notice this ;)

@MikeAlhayek
Copy link
Member

@MatthijsKrempel Do you remember why a UI for this module was created? I find it kind of odd that we have a CORS UI when the policies created there still need to be consumed in code. If you're already writing code to apply a policy, it seems like defining it in code would make more sense. Maybe a recipe to set up policies would be helpful, but I'm curious—does anyone actually use the UI? Do we even need it?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement CORS feature