-
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
Facebook #2302
Facebook #2302
Conversation
Do you want to do a demo next Tuesday? |
Thank you for the invitation, I would love to do so. |
There's a first time for everything. Better sooner than later 😉 |
src/OrchardCore.Modules/OrchardCore.Facebook/OrchardCore.Facebook.csproj
Outdated
Show resolved
Hide resolved
added a TOC entry moved Admin menu under configuration
{ | ||
Task<FacebookCoreSettings> GetSettingsAsync(); | ||
Task UpdateSettingsAsync(FacebookCoreSettings settings); | ||
Task<ImmutableArray<ValidationResult>> ValidateSettingsAsync(FacebookCoreSettings settings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just require IEnumerable
in interfaces. No need for ImmutableArray
.
@MichaelPetrinolis Can you please fix the conflicts? |
@agriffard done. |
When you planed finish FB login and close / merge in beta 3 this issue? |
oh... #1786 planed in rc :( |
Don't know if this is the reason not merged. I tried to make a guess. |
I was just worried by the dependencies between components, I need to re-focus on this PR to understand why and if they are necessary. Also it is related to the Layout changes from @MatthijsKrempel |
@sebastienros had a look at the code, I don't see any overlap,. |
@MichaelPetrinolis I updated your PR, do you want to review my changes? If you are ok with these then I will merge. |
src/OrchardCore.Modules/OrchardCore.Facebook/Drivers/FacebookCoreSettingsDisplayDriver.cs
Show resolved
Hide resolved
|
||
}).Location("Content:0").OnGroup(FacebookConstants.Features.Core); | ||
} | ||
|
||
public override async Task<IDisplayResult> UpdateAsync(FacebookCoreSettings settings, BuildEditorContext context) | ||
{ | ||
var user = _httpContextAccessor.HttpContext?.User; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the other display driver be updated to perform the authorization check at the same stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked for other patterns, but could only find the same one. I assume you are talking about having the security check inside the shape lambda.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant why moving the authorization check inside the if
block? It's not consistent with what exists elsewhere (but maybe it's the right thing to do, I dunno):
OrchardCore/src/OrchardCore.Modules/OrchardCore.Email/Drivers/SmtpSettingsDisplayDriver.cs
Lines 72 to 82 in 80670ba
public override async Task<IDisplayResult> UpdateAsync(SmtpSettings section, BuildEditorContext context) | |
{ | |
var user = _httpContextAccessor.HttpContext?.User; | |
if (!await _authorizationService.AuthorizeAsync(user, Permissions.ManageEmailSettings)) | |
{ | |
return null; | |
} | |
if (context.GroupId == GroupId) | |
{ |
@@ -46,32 +46,32 @@ public async Task UpdateSettingsAsync(FacebookCoreSettings settings) | |||
await _siteService.UpdateSiteSettingsAsync(container); | |||
} | |||
|
|||
public Task<ImmutableArray<ValidationResult>> ValidateSettingsAsync(FacebookCoreSettings settings) | |||
public Task<IEnumerable<ValidationResult>> ValidateSettingsAsync(FacebookCoreSettings settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of requiring an immutable array on the interface. I remember you had explained why you use them, please remind me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImmutableArray
is a struct
type (that has dedicated LINQ operators so things like Any()
don't allocate enumerators). If you end up exposing it as an IEnumerable
, this benefit is lost and there's no point using ImmutableArray
to build the list.
Personally, I like having ImmutableArray
instead of IEnumerable
when we know the implementation won't be done using an iterator (async methods are very poor candidates for that anyway. We'll have to wait for C# 8 and .NET Core 3.0 to have something better) or when the enumeration could be easily cached. There are many places in OC that could benefit from that, e.g all the IPermissionProvider
implementations could expose the permissions list as a cached ImmutableArray
instead of returning new arrays each time.
I saw two issues, can I commit in this PR or should I create a new one? |
@MichaelPetrinolis sadly @sebastienros already merged your PR, so it's too late to include new commits in this PR. |
{ | ||
public class FacebookLoginSettings | ||
{ | ||
public string CallbackPath { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using PathString
like we now do in the OpenID module could have been a good idea 😄
Thanx , i will double check it in dev branch and create a new PR if necessary |
Facebook module ->Facebook Login integration