Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Bulk Adding of Users to Site View modes: 
User avatar
Member
Member
Armysniper89 - 6/1/2011 2:14:29 PM
   
Bulk Adding of Users to Site
I am using the CMS Import Toolkit Alpha 2 to import users from SiteFinity into our Kentico system that has two sites. We want all users imported to be added to atleast one of the sites. After doing the import, how can I do a bulk assignment of users to a site?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/1/2011 2:50:21 PM
   
RE:Bulk Adding of Users to Site
Hello,

You will need to create the bindings manually. Please take a look at the CMS_UserSite table. This table ensures the user to site relationship. You can simply create a query updating the values and adding the userId and siteId to the columns which correspond to your users and sites.

Best regards,
Boris Pocatko

User avatar
Member
Member
lancetek - 6/1/2011 4:35:25 PM
   
RE:Bulk Adding of Users to Site
While the import toolkit is fantastic to move data between systems, for custom tweaking, you may want to create your own application to clean and manipulate the data in Kentico.

For what it's worth, I too looked at doing SQL tweaks to create/delete/update things, but I was worried I'd hose the database... but I tried anyway and ended up loosing an hour of work when I realized that my development db didn't work anymore - I was importing documents and had broken the tree... luckily I'd backed up the db just prior to doing my foolishness!

So I swiftly moved over to using the API. FYI - The Kentico API allows you to do pretty much anything you can think of to the Kentico objects. So I created a little console project to read the source db and the destination kentico db and manipulate and tweak the objects as I needed them. I have about 6000 documents to play with, so doing anything by hand (using the backoffice) was out of the question.

See how to use the API here.

See using Kentico API outside of the Kentico application.

Good Luck,
Lance

PS - it helps if you have access to the Kentico 'source' so you can look up how to do certain things the way the Kentico guru's do it.


User avatar
Member
Member
Armysniper89 - 6/1/2011 4:55:56 PM
   
RE:Bulk Adding of Users to Site
Yea I am actually trying to AVOID that idea of using code which was what I planned on doing when my project kicked off. The import toolkit does a really good job of handling my users and importing them. I would always test things extensively anyways and always keep a backup before you do things or test it in a Virtual Machine environment (highly recommend you use Virtual Machines if you can since you can roll back your entire machine if needed and no harm no foul).

Anyways I added to the User Voice a suggestion to allow users to be added by bulk to multiple sites. You can make users global (which means not available on any site) or a single site. I want to be able to select ALL sites and have them added to all.

Still does not solve the need for me to have to assign Roles to users manually. But a simple project should suffice for that versus writing a huge import tool to do a one time job.

User avatar
Member
Member
lancetek - 6/2/2011 3:56:43 AM
   
RE:Bulk Adding of Users to Site
I still used the import tool. FYI Here's what my workflow looked like:

1 - restore dump to MySQL Server (this is where the data to be imported came from)
2 - Use 'MySQL to MSSQL' tool to get the data into a temp MSSQL db.
3 - Use the Import toolkit to get the data from the temp db into the Kentico db.
4 - Use my custom console app to tweak the info in Kentico. Some of the actions needed to look at the temp db to copy object relationships,etc that the import toolkit couldn't do.

So the import toolkit does about 80% of the importing work and my console app does the other 20%.

It's not very difficult to create your own app. Kentico has worked pretty hard to make it straightforward to do, with adequate documentation and access to the API.

One thing to note is that the API is not very fast. If you have thousands of records, it could take hours to apply your tweaks. eg my 6000 documents take about 2 hours of running the console app to apply all the tweaks. So if you need speed you may want to investigate the SQL route.

There may be some obvious performance improvements I could do with the console app, but since I'm only using it for this one project, I decided I could just let it churn for a couple of hours, and as such it's a classic example of 'duct tape programming'!

Cheers,
Lance