3 Replies Latest reply on Aug 18, 2014 10:29 AM by JohnWolcott

    Importing users

    JohnWolcott

      Title

      Importing users

      Post

           Is it possible to import a list of users, passwords and privilege sets from one database to another.  I am rebuilding a large database with about 45 accounts, and I would like to import all of those accounts into the new database so users don't have to create new passwords, and more importantly, I don't have to set up 45 new accounts.  Didn't see anything in the KnowledgeBase or on this forum about it.

        • 1. Re: Importing users
          FentonJones

                

               Well, it is possible to script the creation of new accounts (in the Accounts scripts group). But the question is whether it will save you time. You need 3 things for each. Account name (login name, can be text), password (can be text), and Privilege Set (cannot be text, must be specified, must already exist).
                
               If you have a table with the 3 fields, "account_name", "password" and "privilege", then you could run the following script (running on 1 record, to create 1 account):
                
               # New 1 Account
               Freeze Window
               #
               If [ IsEmpty (ST__Staff::Password) or IsEmpty(ST__Staff::Account_name) or IsEmpty(ST__Staff::Privileges) ] 
               Beep
               Show Custom Dialog [ Title: "Empty Field"; Message: "Name, Password or Privileges are empty"; Default Button: “Cancel”, Commit: “Yes” ]
               Exit Script 
               End If
               #
               Commit Records/Requests [ No dialog ] 
               If [ ST__Staff::Privileges = "User"]
               Add Account [ Account Name: ST__Staff::Account_name; Password: ST__Staff::Password; Privilege Set: “User” ]
               Else If [ ST__Staff::Privileges = "Manager" ]
               Add Account [ Account Name: ST__Staff::Account_name; Password: ST__Staff:: Password; Privilege Set: “Manager” ]
               Else If [ ST__Staff::Privileges = "Admin" ]
               Add Account [ Account Name: ST__Staff::Account_name; Password: ST__Staff:: Password; Privilege Set: “Admin” ]
               End If
               Commit Records/Requests [ No dialog ] 
                
               So you need the three Privilege Set(s), with those names (obviously you'd use your own names; but notice each must be hard-coded into the script by choosing it from the list in that file.
                
               You could then put a Loop around the above script (making sure it would stop after the last record of people. But really, unless you plan to switch these often (there are also script steps to Change or Reset password, or Delete an account), it is questionable whether you'd be saving time. In either case it would be nice to have the list of the account names. You can get this, if you have FileMaker Pro Advanced, via an Database Design Report (DDR); but like you have the list already (somewhere). You cannot get the "passwords" from FileMaker, as it is a safety concern. 
                
               There are other options, for the script. If you want the people to create their own passwords, that is a checkbox option of the above script step, to "[x] User must change password on next login". Then you give them all a generic password, so they can get started, and they'll specify their real password in their first login; you'll never see it. You could also, if you want to be safe, delete the records you'd used to create those accounts (removing the data, as it's no longer needed after you've created the account).
                
               Basically, all of the this scripting of accounts was very important when we had databases with several separate files. If you have only 1 file, it's questionable.
                
               P.S. Another option, if you want to keep the data, is to "encode", then later, "decode" the text, either a Custom Function (from others), or, (I think) FileMaker Pro 13 can do this (?).
          • 2. Re: Importing users
            philmodjunk

                 It would be very useful if we had such a feature. A script step to import accounts from one file to an identical copy would also be very useful to further simplify the update process when you distribute an updated copy of your solution to multiple clients.

                 Time to visit http://www.filemaker.com/company/contact/feature_request.html and post a new feature request...

            • 3. Re: Importing users
              JohnWolcott

                   Thank you Fenton and PhilModJunk.  I have submitted the request form on the new request form webpage.