Developer forum

Forum » Development » Creating extranet users in code or import

Creating extranet users in code or import

Nicolai Høeg Pedersen
Reply

Just had a mail communication on importing users to Dynamicweb - this is my answer which can come in handy for others. Answers in blue.




 




One of our partners needs to be able to import users from a CSV file. Besides standard info like a user name and password they also need to import a lot of custom data about the user.




 




The idea is to create a custom module, import the data into a custom database table and create a new user in a specific Extranet group for each record.




 




I have the following few questions:




 




1.       Can we easily import / create users in Extranet? If so, where can I find a code example?




There is no extremely easy way – simply add records to AccessUser table of database Access.mdb




 




There is a lot of information – the following needs a value:



AccessUserUserName – the username




AccessUserPassword – weel, you guess.




AccessUserName – the name of the user




AccessUserGroups – groups to be a member of. They are registered in the international w3c standardization iso format of @420@@422@ where the numbers are IDs of groups. Groups are found in the same table but with type of 11.




AccessUserType – must be set to 15




 




2.       Is it easy to *delete* users from the Extranet module again? They need to be able to do something like: “delete all users from group XX where Login NOT In (select * from CSV file)” That is, delete all users that are not offered again in the import file




Simple yes – delete from accessuser where not in something AND AccessUserType = 15




3.       How can we update users in the Extranet module?




Simply update.




4.       Is a custom solution the best way to do it? Or can I also solve this with custom fields? How accessible are those to other (custom) modules?




You can use custom fields for this, but they are saved in a xml document on the table in the field AccessUserInformation – simply create the fields, add som information to a test user, and create the same xml using code. If using this technique ore another table is a flavour, but if you need the information to be available in other modules, like ecom, going the xml way will save you loads of time later on.


 


Replies

 

You must be logged in to post in the forum