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

Facebook #2302

Merged
merged 14 commits into from
Nov 20, 2018
Merged

Facebook #2302

merged 14 commits into from
Nov 20, 2018

Conversation

MichaelPetrinolis
Copy link
Contributor

Facebook module ->Facebook Login integration

@sebastienros
Copy link
Member

Do you want to do a demo next Tuesday?

@MichaelPetrinolis
Copy link
Contributor Author

Thank you for the invitation, I would love to do so.
My only concern is that this will be my first time.

@Skrypt
Copy link
Contributor

Skrypt commented Aug 31, 2018

There's a first time for everything. Better sooner than later 😉

added a TOC entry
moved Admin menu under configuration
{
Task<FacebookCoreSettings> GetSettingsAsync();
Task UpdateSettingsAsync(FacebookCoreSettings settings);
Task<ImmutableArray<ValidationResult>> ValidateSettingsAsync(FacebookCoreSettings settings);
Copy link
Member

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.

@agriffard
Copy link
Member

@MichaelPetrinolis Can you please fix the conflicts?

@MichaelPetrinolis
Copy link
Contributor Author

@agriffard done.

@KANekT
Copy link

KANekT commented Oct 29, 2018

When you planed finish FB login and close / merge in beta 3 this issue?

@MichaelPetrinolis
Copy link
Contributor Author

That depends. There are #1786 and #2029 which are related and might change the way third party authentication services are implemented and probably that's the reason that is not yet merged.

@KANekT
Copy link

KANekT commented Oct 30, 2018

oh... #1786 planed in rc :(

@MichaelPetrinolis
Copy link
Contributor Author

Don't know if this is the reason not merged. I tried to make a guess.

@sebastienros
Copy link
Member

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

@MatthijsKrempel
Copy link
Contributor

@sebastienros had a look at the code, I don't see any overlap,.

@sebastienros
Copy link
Member

@MichaelPetrinolis I updated your PR, do you want to review my changes? If you are ok with these then I will merge.


}).Location("Content:0").OnGroup(FacebookConstants.Features.Core);
}

public override async Task<IDisplayResult> UpdateAsync(FacebookCoreSettings settings, BuildEditorContext context)
{
var user = _httpContextAccessor.HttpContext?.User;
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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):

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)
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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.

@sebastienros sebastienros merged commit 80670ba into OrchardCMS:dev Nov 20, 2018
@MichaelPetrinolis
Copy link
Contributor Author

I saw two issues, can I commit in this PR or should I create a new one?
1.The update for core settings does not work(it checks the settings validity without assigning the values from model)
2. When the appsecret is not set, the edit display driver fails due to unprotecting null string ….

@kevinchalet
Copy link
Member

@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; }
Copy link
Member

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 😄

@MichaelPetrinolis
Copy link
Contributor Author

Thanx , i will double check it in dev branch and create a new PR if necessary

@MichaelPetrinolis MichaelPetrinolis deleted the Facebook branch December 23, 2018 06:58
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.

7 participants