Developer forum

Forum » Integration » User Provider - Remove missing users

User Provider - Remove missing users

Lars Larsen
Lars Larsen
Reply

Hi

I want to import users to one usergroup. There are other users in the solution than the ones that are imported. Some of the imported users are member of other usergroups (newsletter subscriptions). These memberships are not imported. Now I have set up this import:

Source = XML provider
Target = User provider – “Remove missing users” is set, “Use email for username” is set, “Destination group” is set to one group


When removing missing users in the import xml file these missing users are not deleted in Dynamicweb. This only works if the setting “Remove users group membership, if group is not in import” is set! Is this a bug?

Running DW v9.4.14


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
When the option “Destination group” is set to one group and “Remove users group membership, if group is not in import” option is NOT set the users that only belong to the “Destination group” are deleted, users that belong to more than just that one group are not deleted - that is by design.
Next case which I need to clarify: When the option “Destination group” is set to one group and you do not have the "AccessUserGroups" column in the mapping and “Remove users group membership, if group is not in import” is ON you would expect the missed users that are members of "Destination group"(and even if they are members of the other groups) to be deleted - but they are not deleted?

Can you try to not to use the “Destination group” option but add the "AccessUserGroups" column with the value of the destination group in your source xml file and check “Remove users group membership, if group is not in import” to see if it will solve your problem?

Regards, Dmitrij

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy 

Thanks for clearifying. 

I have now tried not to use the "Destination group" option but added the "AccessUserGroups" column to the mapping and with the value of the destination group in the source xml file. The setting "Remove users group membership, if group is not in import" was ON. In this setup users removed from the source xml file are deleted in Dynamicweb. BUT users in the xml file who are member of other groups than the group set in the "Destionation group" option these users looses their group memberships. How can I avoid that?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
Looks like it is needed to fix the original case: When the option “Destination group” is set to one group and you do not have the "AccessUserGroups" column in the mapping and “Remove users group membership, if group is not in import” is ON you would expect the missed users that are members of "Destination group"(and even if they are members of the other groups) to be deleted - but they are not deleted
to be fixed in the user provider
Regards, Dmitrij

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

Do I understand you correct: is this something that will be fixed in a future release?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Lars,
yes, tfs# 53147 created.
Regards, Dmitrij

Votes for this answer: 1
 
Lars Larsen
Lars Larsen
Reply

Hi Dmitrij

Do you know when this change will be released?

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Lars

The #53147 UserProvider: fix removing missing users when "Destination Group" and “Remove users group membership, if group is not in import” is ON 

Has now been fixed in Package "Dynamicweb.DataIntegration.Providers.UserProvider" version 1.0.28

You are able to find this update in the backend Package update section.

Also the correction are part of the 9.4.18 release 

You are able to find this build in the download section:

http://doc.dynamicweb.com/releases-and-downloads/releases

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Lars Larsen
Lars Larsen
Reply

Hi Kristian

Thanks :-)

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

The fix doesn't help in my situation. I have just testet a lot of different settings for import using the User provider as Target and can't figure out how to set it up. I import a lot of Active Directory users to a Dynamicweb intranet website. These AD users can sign up for newslettes on the intranet. But how can I setup the import in order to preserve these subscriptions after an import and in the same time have AD users in DW deleted if they have been deleted in AD? In older DW8 versions there were this option "Do not remove a user from NewsletterRecipient group". Where did that go in DW9?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
option "Do not remove a user from NewsletterRecipient group" was removed from the UserProvider as there is no more "NewsletterRecipient group" by default in Dynamicweb 9.
Maybe as a workaround you can make more jobs: One for exporting your users that have subscriptions to xml and one for importing them back after you execute your current remove missing users job, so your subscription users will be imported back.
Regards, Dmitrij

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

I'm not sure it will solve my problem by making more jobs. If I did that wouldn't an AD user who subscribe to a newsletter be created again when I run the import of subscription users even if the user has been deleted in the AD? Is custom code the only solution to solve this issue?

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
yes, you could use the TableScript functionality to create a class that will implement the ProcessInputRow method.
You need to add the "AccessUserGroups" column to the source xml and in the job mappings and then in the ProcessInputRow you can check the user and its groups:
find that user in Dynamicweb and check his groups and add relevant groups you need to the row["AccessUserGroups"] with a comma-separated string value like: GroupId1, GroupId2.
Regards, Dmitrij
 

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

I have testet with a TableScript as you suggested. But know all users in the solution that belong to more than one group are deleted! My setup is:

Remove missing users = ON
Destination group = Set to one existing group
Remove users group membership = ON
Use email for username = ON
"AccessUserGroups" column is in the source xml and in the job mappings

In ProcessInputRow I set row["AccessUserGroups"] to the groups that the processed user belongs to (eg. row["AccessUserGroups"] = "11,8")

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
try with Remove users group membership = OFF
Regards, Dmitrij

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

With "Remove users group membership" OFF users deleted in AD and who are member of more than one group in Dynamicweb are not deleted! As you wrote earlier in this thread this behavior is by design. And this is the exact problem I am struggeling frown

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
could you try
Destination group = remove/set to none
Remove users group membership = OFF
"AccessUserGroups" column is in the source xml and in the job mappings and
ProcessInputRow set row["AccessUserGroups"] to the groups that the processed user belongs to + add the destination group id

And in the job mappings AccessUSer table add condition:

Where 123 should be your destination group id.
And run with that.
Regards, Dmitrij

 

 

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

Just done what you suggested. All users except system users (Angel, Administrator, Admin) are deleted!! If I remove the conditional on AccessUserGroups then the users from the XML input file are preserved but all other non system users are deleted!! Something strange is that my TableScript does not run if there is a conditional on AccessUserGroups.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
Sorry for incorrect advise. The TableScript is not applied because the Xml provider source reader is skipping all rows, it is needed to set the "AccessUserGroups" column in the source xml with a value of "123"/your destination group id so the condition will allow reading those rows. Then you can skip adding this group in the table script row["AccessUserGroups"] value.

Regards, Dmitrij
 

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

Now I replaced the name of the user group in the XML file in the field AccessUserGroups with the id (11) of the destination user group. When running the import users from the XML input file are preserved but all other non system users are deleted again!! My setup is:

Remove missing users = ON
Destination group = NONE
Remove user group membership = OFF
Use email for username = ON
AccessUserGroup in XML file set to id (11) of destination group
TableScript ON - sets AccessUserGroup to its initial value
Condition on AccessUserGroups (AccessUserGroups contains 11) on table AccessUser

I have attached my database, the activity job, the tablescript and the XML input file. So I hope you will use that to try to figure out the right setup. The database contains two AD users (Rolf and Linda) in the group "AD Users / *ADM-C - Alle ansatte i KAB (9999) og brugere i VV_ST) and three other users (Kent, Bent, Ole) in the group "Other users". The group "Newsletter subscribers contains Kent, Rolf and Bent. 

Thank in advance smiley

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
User provider is not working here for your specific case. In order to remove the needed users you need to use the Sql provider and its conditions.
I've attached the job, changed xml file to suit the SQL provider and table script for sql provider.
So you can run the sql provider job first to remove the missing users and if the import result is not complete as with the user provider than you can run your job with user provider(without Remove missing users option)
Xml source file was changed to include the <column columnName="AccessUserType"><![CDATA[5]]></column> so filtering on this will work.
SQL provider has "remove missing option" on and conditions to AccessUserType = 5 and AccessUserGroups contains 11 - to remove users that can belong to other groups but needs to be removed if belong to 11 group.
Table script for SQL provider fills the groups with a syntax they are stored in db.
Hope this would help.
Regards, Dmitrij
 

 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

Thanks, looks interesting. I will look into it. But I can't download TableScriptSample.cs. Will you change the suffix to txt or zip the fil. Thanks in advance smiley

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
 
Lars Larsen
Lars Larsen
Reply

Hi Dmitriy

Thanks a lot. It works smiley

But how come it doesn't work when the User Provider is used? Shouldn't it work the same way as the SQL Provider? 

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Lars,
no it shouldn't. The User provider has a lot of functionality to match exisitng users and groups and doesn't allow conidions on a "AccessUserGroups" column and that's it wasn't suitable for your case where you want to keep other relations and delete from specific group.
Regards, Dmitrij

 

You must be logged in to post in the forum