A Forum reader recently asked:
“We have a login script that our Marketing department uses, but there are sometimes people who work on our webpage who need an administrative account. Can we adapt the script to work for them as well?”
And here’s the response from David Guest …
You can’t easily tell if the user is going to need the admin privileges or not. So you need to ask them. I would do some thing like this:
Dialog Class "#32770" Title "Netzwerkkennwort eingeben" EndDialog If %Department eq "Marketing" MessageBox -yesno ?Answer "Do you need Administration Access ?" If ?Answer eq "Yes" SetPlat MarketingAdmin Setprompt "Admin Username:" Type $Username #1218 Setprompt "Password:" Type $Password #1219 Click #1 EndScript EndIf EndIf Type ?Sysuser #1218 Type ?Syspassword #1219 Click #1 Setprompt "Enter your sign-on variables" ## EndSection: "Login Window"
This uses a directory variable “Department” to determine that the user is in the Marketing department. You may want to use a different variable though – for example, you could try something like:
If $SysUser(system) -In "NAme 1 Name2 Name3 Name4"