MemberService.GetAllRoles Returns No Results for Members
Are there any known issues with the GetAllRoles method in v7? I am getting no results using member id or login name yet if I use System.Web.Security.Roles.GetRolesForUser(loginName) I do get results albeit the wrong results.
Using the System.Web.Security.Roles.GetRolesForUser method I am not getting accurate results where I am calling it in my MemberIndexerGatheringNodeData event handler. If I change the member groups in Umbraco and save the member I do not get back the new groups only the previous groups until the member is saved for a second time. This leads to inaccurate data being stored in the examine index for members.
If there are known issues any suggestions to work around this without having to rely on editors to save members twice would be helpful.
Until a few moments ago I was still fighting with this issue but thanks to this post which led me to a workaround for the problem I finally have something working! Quite obvious now looking at it.
private void MemberService_Saved(IMemberService sender, global::Umbraco.Core.Events.SaveEventArgs<IMember> e)
{
foreach (var member in e.SavedEntities)
{
// Reindex node after a delay to work around the fact that roles have not
// been updated by the time the MemberService.Saved event executes
System.Threading.Tasks.Task.Run(() =>
{
System.Threading.Thread.Sleep(5000);
ExamineManager.Instance.ReIndexNode(member.ToXml(), IndexTypes.Member);
});
}
}
MemberService.GetAllRoles Returns No Results for Members
Are there any known issues with the
GetAllRoles
method in v7? I am getting no results using member id or login name yet if I useSystem.Web.Security.Roles.GetRolesForUser(loginName)
I do get results albeit the wrong results.Using the
System.Web.Security.Roles.GetRolesForUser
method I am not getting accurate results where I am calling it in myMemberIndexerGatheringNodeData
event handler. If I change the member groups in Umbraco and save the member I do not get back the new groups only the previous groups until the member is saved for a second time. This leads to inaccurate data being stored in the examine index for members.If there are known issues any suggestions to work around this without having to rely on editors to save members twice would be helpful.
Thanks
Until a few moments ago I was still fighting with this issue but thanks to this post which led me to a workaround for the problem I finally have something working! Quite obvious now looking at it.
Mission accomplished! If I was able to at least help one - it was worth the effort 😉. Glad it helped and thank you for your reply. 🤟#h5yr2
is working on a reply...