McG Posted November 14, 2007 Posted November 14, 2007 File 1 has a number of accounts with passwords. File 2 needs these same accounts and passwords. Can anyone tell me the except script steps required using create new account to do this automatically? I think if I don't have it step by step, I'm not going to get. Thanks.
Cortical Posted November 23, 2007 Posted November 23, 2007 I use this in a DSM file pair, it allows new accounts for 2 privilege sets, change password, delete account. It works over SSH/RDC connection as well, for remote admin. Requires 2 scripts, the second in the second file (note the global passing) manage - user accounts #only admin privilege set may run this script If [ Get ( ScriptParameter ) = "add account" ] #NEW ACCOUNT # #Speicify Privilige set Show Custom Dialog [ Title: "Create a NEW user account"; Message: "Please specify the Privilge Set to be assigned to the new user account."; Buttons: “AAAAA”, “BBBBB” ] If [ Get ( LastMessageChoice ) = 1 ] Set Field [ uAdmin::g_Privilege Set; "AAAAA" ] Else If [ Get ( LastMessageChoice ) = 2 ] Set Field [ uAdmin::g_Privilege Set; "BBBBB" ] End If # #Adds a new account name, password, and preconfigered privilege set. #enter the new account name and password Show Custom Dialog [ Title: "Create a NEW user account"; Message: "Enter the username and password for the new account. Then click OK to create the account."; Buttons: “OK”, “Cancel”; Input #1: uAdmin::g_AcctName, "Account name: "; Input #2: uAdmin::g_AcctPW, Password, "Account password: "; Input #3: uAdmin::g_Privilege Set, "Privilege Set: " ] #trap for cancel If [ Get ( LastMessageChoice ) =2 ] Show Custom Dialog [ Title: "Cancel"; Message: "Ok, the script will now cancel, and no changes have been made."; Buttons: “OK” ] Halt Script End If # # #create the new account in USER file: using the global values If [ uAdmin::g_Privilege Set = "AAAAA" ] #AAAAA privilege set # You must be assigned the Full Access privilege set to perform this script step. Select Run script with full access privileges to enable users with less than full access privileges to perform this script step Add Account [ Account Name: uAdmin::g_AcctName; Password: uAdmin::g_AcctPW; Privilege Set: “AAAAA” ] Else If [ uAdmin::g_Privilege Set = "BBBBB" ] #BBBBB privilege set Add Account [ Account Name: uAdmin::g_AcctName; Password: uAdmin::g_AcctPW; Privilege Set: “BBBBB” ] End If # #create the new account in DATA file: using the global values, AAAAA privilege set Perform Script [ “add - user accounts” from file: “B_XXXX_DATA”; Parameter: "add account" ] # #mandatory refresh to force clear the globals Commit Records/Requests [ Skip data entry validation; No dialog ] # #clear the globals Set Field [ uAdmin::g_AcctName; "" ] Set Field [ uAdmin::g_AcctPW; "" ] End If # # If [ Get ( ScriptParameter ) = "change pw" ] #CHANGE PASSWORD #Resets the password of the existing FileMaker Pro account you specify #You must be assigned the Full Access privilege set to perform this script step Show Custom Dialog [ Title: "Change the password for an existing account"; Message: "Please enter the name of the account for which you wish to change the password, and the new password to be used: " & "¶¶" & "You can do this for any account, when logged in as a full access account"; Buttons: “OK”, “Cancel”; Input #1: uAdmin: g_AcctName, "Account name:"; Input #2: uAdmin::g_AcctPW, Password, "Account password:" ] #trap for cancel If [ Get ( LastMessageChoice ) =2 ] Show Custom Dialog [ Title: "Cancel"; Message: "Ok, the script will now cancel, and no changes have been made."; Buttons: “OK” ] Halt Script End If # Reset Account Password [ Account Name: uAdmin::g_AcctName; New Password: uAdmin::g_AcctPW ] # #change the password in DATA file: using the global values Perform Script [ “add - user accounts” from file: “B_XXXX_DATA”; Parameter: "change pw" ] # #mandatory refresh to force clear the globals Commit Records/Requests [ Skip data entry validation; No dialog ] # #clear the globals Set Field [ uAdmin::g_AcctName; "" ] Set Field [ uAdmin::g_AcctPW; "" ] End If # # If [ Get ( ScriptParameter ) = "DELETE ACCOUNT" ] #DELETE ACCOUNT #Resets the password of the existing FileMaker Pro account you specify #You must be assigned the Full Access privilege set to perform this script step Show Custom Dialog [ Title: "Delete an existing account"; Message: "Please enter the name of the existing user account to delete." & "¶¶" & "You must specify an existing account." & "¶" & "You must be assigned the Full Access privilege set to perform this script. " & "¶" & "You cannot use this script to delete an account that has full access privileges."; Buttons: “OK”, “Cancel”; Input #1: uAdmin::g_AcctName, "Account name: " ] #trap for cancel If [ Get ( LastMessageChoice ) =2 ] Show Custom Dialog [ Title: "Cancel"; Message: "Ok, the script will now cancel, and no changes have been made."; Buttons: “OK” ] Halt Script End If # Delete Account [ Account Name: uAdmin::g_AcctName ] # #change the password in DATA file: using the global values Perform Script [ “add - user accounts” from file: “B_XXXX_DATA”; Parameter: "DELETE ACCOUNT" ] # #mandatory refresh to force clear the globals Commit Records/Requests [ Skip data entry validation; No dialog ] # #clear the globals Set Field [ uAdmin::g_AcctName; "" ] Set Field [ uAdmin::g_AcctPW; "" ] Set Field [ uAdmin::g_Privilege Set; "" ] End If # # If [ Get ( ScriptParameter ) = "RELOGIN" ] #RE-LOGIN under a different account Show Custom Dialog [ Title: "Logout of the current account, and re-login"; Message: "You are currently logged in as :" & "¶¶" & "Account: " & Get ( AccountName ) & "¶" & "Privilege set: " & Get ( PrivilegeSetName ) & "¶¶¶" & "If you choose to proceed, you will be logged out from this account, and asked to relogin."; Buttons: “Proceed”, “Cancel” ] #trap for cancel If [ Get ( LastMessageChoice ) =2 ] Show Custom Dialog [ Title: "Cancel"; Message: "Ok, the script will now cancel, and no changes have been made."; Buttons: “OK” ] Halt Script End If Re-Login [ ] End If # #force refresh & flush Enter Preview Mode Enter Browse Mode Flush Cache to Disk Commit Records/Requests [ Skip data entry validation; No dialog ] #CLEAR uAdmin account globals Set Field [ uAdmin::g_Privilege Set; "" ] Set Field [ uAdmin::g_AcctName; "" ] Set Field [ uAdmin::g_AcctPW; "" ] second script add - user accounts #only admin privilege set may run this script; this subscript is called by the add account script in User If [ Get ( ScriptParameter ) = "add account" ] If [ uADMIN::g_Privilege Set = "AAAAA" ] Add Account [ Account Name: uADMIN::g_AcctName; Password: uADMIN::g_AcctPW; Privilege Set: “AAAAA” ] Else If [ uADMIN::g_Privilege Set = "BBBBB" ] Add Account [ Account Name: uADMIN::g_AcctName; Password: uADMIN::g_AcctPW; Privilege Set: “BBBBB” ] End If Else If [ Get ( ScriptParameter ) = "change pw" ] Reset Account Password [ Account Name: uADMIN::g_AcctName; New Password: uADMIN::g_AcctPW ] Else If [ Get ( ScriptParameter ) = "DELETE ACCOUNT" ] Delete Account [ Account Name: uADMIN::g_AcctName ] End If Close Window [ Current Window ]
Recommended Posts
This topic is 6212 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now