My Membership is hooked up just fine. But the Roleprovider seems to be broken in umbraco 8.
When i try to add role based access to a node, or simply inspect the Member Groups in the Members tab - no groups show up.
I've verified that the Roles.Provider is indeed set to my custom one during startup. The Constructor is also called. But GetAllRoles are never called when i inspec member groups nor when i try to assign groupbased access..
Did any of you guys play with the RoleProvder in Umbraco 8 ?
Here's my code if anyone's intrested:
public class SpiderMembershipUmbracoRoleProvider : RoleProvider
{
public override string ApplicationName { get => "spider"; set => throw new NotImplementedException(); }
public SpiderMembershipUmbracoRoleProvider()
{
Console.WriteLine("TEST");
}
public override string[] GetAllRoles() { return new string[] { "SpiderUsers" }; }
public override bool IsUserInRole(string username, string roleName)
{
if (roleName.ToLower() == "spiderusers")
return true;
else
return false;
}
public override string[] GetRolesForUser(string username)
{
return new[] { "SpiderUsers" };
}
public override void CreateRole(string roleName)
{
throw new NotImplementedException();
}
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
{
throw new NotImplementedException();
}
public override bool RoleExists(string roleName)
{
throw new NotImplementedException();
}
public override void AddUsersToRoles(string[] usernames, string[] roleNames)
{
throw new NotImplementedException();
}
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
{
throw new NotImplementedException();
}
public override string[] GetUsersInRole(string roleName)
{
throw new NotImplementedException();
}
public override string[] FindUsersInRole(string roleName, string usernameToMatch)
{
throw new NotImplementedException();
}
}
the solution actually is right there in the comment.
Create a class implementing IMemberGroupService and then create a class implementing IUserComposer and in that class's compose method make the above method call.
just note that this is a soltion i made work on umbraco 8.0.1 i think, which is actually a hack - it was not intended to work this way, so hopefully it will be, or has been fixed (Didnt check up on it since may)
I try do this on Umbraco 8.3. It doesn't work when i try to setup Public Access for pages. List of groups is empty. But there are groups in Members/Member Groups. What should i do?
I had the same issue, with it not showing under "Publiv access".
Turned out that your MembershipProvider has to inherit from UmbracoMembershipProviderBase.
Else it willl return an empty list.
Hi
I have the exact same issue that it calls "Initialize" but doesn't call "GetAllRoles" in my custom role provider, I tried your solution "implementing IMemberGroupService", but I don't understand what is the relation between your "SpiderGroupService" and your "SpiderMembershipUmbracoRoleProvider", can you please share more code? Thanks
I am using Auth0 for authentication with UmbracoIdentity, and I want to use my own data store for users and roles (basically bypass Umbraco's built-in member logic all together).
I have the authentication piece as well as the IMemberService and IMemberGroupService pieces working so everything seems to be coming from my custom classes. However, I also made a custom MembershipProbvider, which inherits from MembersMembershipProvider, in order to inject custom implementations of IMembershipMemberService and IMemberTypeService.
I'm unsure if my own MembershipProvider is needed, or do I just need to register those custom implementations in my IUserComposer, and the standard IdentityEnabledMembersMembershipProvider will suffice?
When i pulled in the Umbraco. Web source code it was working again, during this i had only implemented our own RoleProvider, which shouldn't affect anything - so i guess it was just a brief bug
Custom Roleprovider in Umbraco 8 - Broken ?
Hi.
In my umbraco 8 solution, im trying to add my own roleprovider, as i've done many times before in Umbraco 7.
Using this as inspiration: https://24days.in/umbraco-cms/2015/extending-membership/
My Membership is hooked up just fine. But the Roleprovider seems to be broken in umbraco 8.
When i try to add role based access to a node, or simply inspect the Member Groups in the Members tab - no groups show up.
I've verified that the Roles.Provider is indeed set to my custom one during startup. The Constructor is also called. But GetAllRoles are never called when i inspec member groups nor when i try to assign groupbased access..
Did any of you guys play with the RoleProvder in Umbraco 8 ?
Here's my code if anyone's intrested:
And my web config:
This morning i decided to add the source code for Umbraco.Web to my project.
I modified the default implementation of MemberRoleProvider - adding a "test" role to the GetAllRoles default implementation.
This change wasn't noticable in the backoffice either, so it seems like it doesn't even use the MemberRoleProvider anylonger.
Anyone has a clue which API is being called when umbraco gets the Member roles ?
Okay so i found the correct way to do it in Umbraco 8.
I needed to Implement my own IMemberGroupService.
Then During Compose in a IUserComposer i could call:
now my custom usergroups shows up.
Can you point me at a working solution please?
Umbraco is generally superb, but I do hate custom membership providers
the solution actually is right there in the comment.
Create a class implementing IMemberGroupService and then create a class implementing IUserComposer and in that class's compose method make the above method call.
just note that this is a soltion i made work on umbraco 8.0.1 i think, which is actually a hack - it was not intended to work this way, so hopefully it will be, or has been fixed (Didnt check up on it since may)
I try do this on Umbraco 8.3. It doesn't work when i try to setup Public Access for pages. List of groups is empty. But there are groups in Members/Member Groups. What should i do?
I had the same issue, with it not showing under "Publiv access". Turned out that your MembershipProvider has to inherit from UmbracoMembershipProviderBase. Else it willl return an empty list.
https://github.com/umbraco/Umbraco-CMS/blob/1eb0c93e053781cc48f801a878dee3609d92bc71/src/Umbraco.Web/Editors/MemberGroupController.cs#L121
Hi I have the exact same issue that it calls "Initialize" but doesn't call "GetAllRoles" in my custom role provider, I tried your solution "implementing IMemberGroupService", but I don't understand what is the relation between your "SpiderGroupService" and your "SpiderMembershipUmbracoRoleProvider", can you please share more code? Thanks
Hi,
I am using Auth0 for authentication with UmbracoIdentity, and I want to use my own data store for users and roles (basically bypass Umbraco's built-in member logic all together).
I have the authentication piece as well as the IMemberService and IMemberGroupService pieces working so everything seems to be coming from my custom classes. However, I also made a custom MembershipProbvider, which inherits from MembersMembershipProvider, in order to inject custom implementations of IMembershipMemberService and IMemberTypeService.
I'm unsure if my own MembershipProvider is needed, or do I just need to register those custom implementations in my IUserComposer, and the standard IdentityEnabledMembersMembershipProvider will suffice?
When i pulled in the Umbraco. Web source code it was working again, during this i had only implemented our own RoleProvider, which shouldn't affect anything - so i guess it was just a brief bug
is working on a reply...