I'm programatically altering users member details, however the members cache is causing me all sorts of issues.
Disabling the cache in umbracoSettings > UmbracoLibraryCacheDuration and setting to zero, but I don't necessarily want to disable this for everything.
Is there a way to clear a particular members cache profile? So I can instantly see the updates I'm making? In particular I'm using Member Groups and assigning groups.
'System.Array' does not contain a definition for 'DeleteRole' and no extension method 'DeleteRole' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
Ok, for the purpose of testing at the moment, I'm actually deleting them through the back office as you would do normally.
So this code below, gets a list of groups from Active Directory, I check to see if they already exist in the system - if they don't I add them and if they do I assign them to the user I'm importing.
It's the GetByName functions thats throwing me off, as after the group is deleted it still thinks there something there.
foreach (string group in userGroups)
{
if (memberGroupService.GetByName(group) == null)
{
MemberGroup mg = new MemberGroup
{
Name = group,
};
memberGroupService.Save(mg);
}
if (group == "Group 1" || group == "Group 2")
{ memberService.AssignRole(newUserAccount.Id, group);
}
}
}
}
Ok, so here's the code I'm running with at the moment. I'm looping through a string list of groups from Active Directory, I then check to see if these groups exist in Umbraco. If they don't then create them, if they do then assign them to the user being imported. Teh problem we seem to have is that even with the database void of member groups the GetByName function still thinks there's something in there.
foreach (string group in userGroups)
{ if (memberGroupService.GetByName(group) == null)
{
MemberGroup mg = new MemberGroup
{
Name = group,};
memberGroupService.Save(mg);
}
if (group == "Group1" || group == "Group2")
{ memberService.AssignRole(newUserAccount.Id, group);
}
}
I did consider this, but I need to be able to authenticate without be prompted to enter login details, which I don't think you can do with the Package you mentioned.
Clearing Member Cache
Hello,
I'm programatically altering users member details, however the members cache is causing me all sorts of issues.
Disabling the cache in umbracoSettings > UmbracoLibraryCacheDuration and setting to zero, but I don't necessarily want to disable this for everything.
Is there a way to clear a particular members cache profile? So I can instantly see the updates I'm making? In particular I'm using Member Groups and assigning groups.
Many thanks
Paul
This is a setting for content. Members are on Examine. You need to rebuild the index in the developer section
https://our.umbraco.org/documentation/reference/config/umbracosettings/
Hey Marcio,
Thanks for the response, can this be triggered programatically though?
Thanks
Paul
Sure!
https://gist.github.com/kevinblake/4000628
http://www.jondjones.com/learn-umbraco-cms/umbraco-developers-guide/umbraco-search/how-to-rebuild-your-umbraco-examine-indexes
Recently a member used a scheduled task to schedule indexing. Be interested.
https://our.umbraco.org/forum/using-umbraco-and-getting-started/85822-problem-extreme-slowly-loading-website#comment-272021
https://our.umbraco.org/Documentation/Reference/Config/umbracoSettings/#scheduledtasks
I clicked the rebuild but it didn't do anything.
The issue I have is that I've deleted all the Member Groups from the system, yet when I run this:
It always returns a value - even though the Database entries in UmrbacoNode are gone.
I need to make sure these old entries are purged, but I don't know where to purge them from.
Thanks
Paul
Got it. Member Groups are based on system.Web.Security.Membership as Roles.
If you are not removing through the MemberGroupService, which is strange, try the RoleProvider.
https://24days.in/umbraco-cms/2015/extending-membership/
Hi Marcio,
That didnt work either.I just get this error:-
'System.Array' does not contain a definition for 'DeleteRole' and no extension method 'DeleteRole' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)
How are you trying to remove it? show code please
Ok, for the purpose of testing at the moment, I'm actually deleting them through the back office as you would do normally.
So this code below, gets a list of groups from Active Directory, I check to see if they already exist in the system - if they don't I add them and if they do I assign them to the user I'm importing.
It's the GetByName functions thats throwing me off, as after the group is deleted it still thinks there something there.
Ok, so here's the code I'm running with at the moment. I'm looping through a string list of groups from Active Directory, I then check to see if these groups exist in Umbraco. If they don't then create them, if they do then assign them to the user being imported. Teh problem we seem to have is that even with the database void of member groups the GetByName function still thinks there's something in there.
have you set up any Active Directory provider?
UPDATE:
var memberGroupService = ApplicationContext.Current.Services.MemberGroupService;
I haven't as such, I'm literally importing users into Umbraco rather than running off AD directly.
But you can use AD in umbraco
https://our.umbraco.org/projects/developer-tools/active-directory-providers/
I already used this package and it works fine
I had understood that you only needed to import AD users
UPDATE:
these are links of examples and ideas that helped me in the project that uses integration with AD
https://24days.in/umbraco-cms/2016/authenticating-with-ad-fs-and-identityextensions/
http://blog.dampee.be/post/2014/02/12/Umbraco-Backoffice-integration-with-Active-Directory.aspx
https://github.com/Bitmapped/UmbBackofficeMembershipProvider
https://www.jdibble.co.uk/blog/securing-umbraco-backoffice-with-azure-active-directory/
http://skrift.io/articles/archive/authenticate-to-umbraco-73plus-using-active-directory/
Hi again,
I did consider this, but I need to be able to authenticate without be prompted to enter login details, which I don't think you can do with the Package you mentioned.
Hope this makes sense,
Thanks
Paul
is working on a reply...