U4-10383 - Feature request - Ignore casing when getting member email and username from IPublishedContent

Created by Bjarne Fyrstenborg 04 Sep 2017, 14:08:59 Updated by Sebastiaan Janssen 06 Sep 2018, 09:25:57

Tags: Gold partner

When using MembershipHelper to get e.g. current member, which return IPublishedContent, it seems property alias is specific to casing. http://issues.umbraco.org/issue/U4-5456 https://github.com/Umbraco/Umbraco-CMS/commit/d2592bd79f94e48ccfa9b23b6f474e42b5e48e5f

E.g. not following work with "Email" but not "email", e.g. camelcase for e.g. "userName".

var helper = new UmbracoHelper(UmbracoContext.Current);
var member = helper.MembershipHelper.GetCurrentMember();
var email = member.GetPropertyValue<string>("Email");

Could it ignore casing for these specific property aliases? https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs#L132-L138

In the UI Umbraco suggest / generate alias in camelcase, so it would be great to be able to access these member properties using camelcase too.

I know one also can cast IPublishedContent as MemberPublishedContent, but I am not sure if that can be casted to specific member types using ModelsBuilder. E.g. when member is returning IPublishedContent and I have two member types (two generated clases) Customer and Employee, I can use the following:

var helper = new UmbracoHelper(UmbracoContext.Current);
var member = helper.MembershipHelper.GetCurrentMember();
bool isCustomer = member is Customer;

1 Attachments

Comments

Sebastiaan Janssen 06 Sep 2018, 09:25:50

Fixed in : https://github.com/umbraco/Umbraco-CMS/commit/5986899b5edf30023624e6d4c91c939cbc1619ee

Thanks @Bjarne.Fyrstenborg !


Priority: Normal

Type: Feature (request)

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.0, 7.6.5, 7.6.6, 7.7.1, 7.6.7, 7.6.8, 7.7.2, 7.6.9, 7.7.3, 7.6.10, 7.7.4, 7.6.11, 7.7.5, 7.6.12, 7.7.6, 7.7.7

Due in version: 7.13.0

Sprint:

Story Points:

Cycle: