This project is read-only.

Adding Users - Best Practice..

Topics: Administration, General, Writing modules
Dec 29, 2013 at 11:32 PM
Whats the best practice, or at least the recommended approach for creating site users?

I want to store a list of people, who may or may not use the system directly.....for arguments sake, I want to store companies within the solution, complete with their staff members and their customers. This could be achieved by creating a company type, and assigning a company administrator who is then able to create Person records and assign roles tp those person records, to control access around the system.

Now I understand how to create the many to many relationships for this scenario, but what I'm struggling to get my head around is Orchard security, the creation of users and registration.

What is the recommended approach for this situation.......

Option 1:
All users register via the front end, in a similar way Spike performs in his WebShop example using a view model which collects information that is stored against User and Person types via the controller. The problem with this approach is that not all 'persons' will require access to the system, so I don't want to force them to register just to create a person record for them.

Option 2:
The company administrator has a page showing a table of person types that relate to them, complete with the ability to add, edit or delete a person. This is easy enough to achieve, and I can attach the UserPart to the Person type easy enough, but how do I go about populating the UserPart details when I create / edit the person type, and how do I give the option for the Person to become a User. I'm assuming for this scenario, I have to disable creation of the Person content type in the data migration, then use custom create, update, delete functionality in a controller rather than the standard create new content type pages.

Option 3:
Update the UserPart with additional fields to as their unique reference number, then create a custom UserProfile module to store additional information at user level. Once again though, not all persons will access the site directly.

This can't be an unusual requirement, can someone recommend an approach, and / or point me in the direction of code samples where a content type and users are related / synchronized.