locked
How do we create new aspnet Users from a spreadsheet (or DB).

    Domanda

  • I need to setup a lot of users based on information in a spreadsheet.

    I am using forms based security.

    The import isn't a problem - we already have examples.

    The code to create the users is the question.

    Please advise.

    martedì 19 luglio 2011 21:29

Tutte le risposte

  • Does this article , "How To Reference Security Entities In LightSwitch",help?

    Or "LightSwitch Active Directory Sample"?


    Yann

    (plus ça change, plus c'est la même chose!)


    mercoledì 20 luglio 2011 00:14
  • Hi Garth,

    Could you import the "Users" tables (and say related Roles/Permissions/Etc) tablex as a separate DataSource and then write code to import the CSV/Excel and create Users and links-to-Roles entities dynamically as if it is just any other table? You will have to look at the properties of the Users table as it will have things like password seeds, etc and you will have to encrypt/hash the password, but it should be do-able with a bit of experimentation.

    I can dig up the built-in password encryption/hash method that ASP uses (and probably LS) if you think this is a possible solution?

    Regards


    Xander
    mercoledì 20 luglio 2011 01:37
  • If we create a DataSource for the aspnet tables the logical question is:

    • Can we read existing aspnet records and just add them into another database or add them to another application in the same database?

    I guess I'll have to just try it and see what happens.  I was hoping someone else would have already done this. 

     

    mercoledì 20 luglio 2011 02:27
  • You should be able to do that, provided that you copy all the fields exactly like they are.

    Question:

    Importing new users is one thing, but copying users from one database to another is quite another. If you need to do that it sounds to me like you want to share user accounts between multiple database? If that is the case, would it not be far better to create a centralized "authentication" database that is shared by all the applications? You should be able to do that with a custom membership and role providers in LS.

    Regards


    Xander
    mercoledì 20 luglio 2011 02:48
  • Hi Garth,

    I have the same question, but I don't see the answer yet, really.

    How can we create/import the users, roles, profiles programmatically from xml, csv or excel into LightSwitch?

    I'm looking for a way to transfer a current asp.net membership info into the lightSwitch app. I can export this data with no problem, but how can we recreate the info into lightswitch?

    Does the LightSwitch API allows us to create that data programmatically?

    I'm sure not going to recreate 20,000 + users by hand into the LightSwitch app!

    Any samples or API pointers?

     

    Burl

     

    domenica 24 luglio 2011 02:42
  • Hiya guys,

    I was able to set up separate data sources for 2 databases and copy user records and security from one app to another.

     

    The ApplicationId GUID from the original database was replaced with the ApplicationID in the target database.

    The Users, Membership, and Profile records were copied.

    Please note the the same user in mulitiple applications will have their own set of records with a separate UserId Guid in each application within the same database.

    It would be an application level development task to keep the password (Membership) and Profile information sync'd between separate apps.

    Vanguard is working with LS apps as (conceptual) modules (within a LOB suite) that may be loosely connected with each other and legacy apps.  The mix could also include hosted WAN and customer LAN sites.

     

     

     



    lunedì 25 luglio 2011 20:37