I am looking for way to create a new account with parental controls, and then set which programs I want the new user to be able to use.
So far I have been able to create a new account with the following script…
do shell script "command" user name "Generic School" password "abc123" with administrator privileges set T_password to "abc" set longUser_name to quoted form of "Student" set user_name to quoted form of "student" set userID to 600 set groupID to 1001 if (do shell script "/usr/bin/dscl . -search /Users name " & user_name) is not "" then display alert "User name " & user_name & " already exists, modify the user name and try it again " return end if -- create account, if (the user ID or the group ID) already exists, loop until the id is unique do shell script "declare dscl=/usr/bin/dscl;t_uid=" & userID & ";g_uid=" & groupID & ";userA=" & user_name & " while [[ -n \"$($dscl . -search /Users uid $t_uid)\" ]]; do t_uid=$[t_uid+1] done while [[ -n \"$($dscl . -search /Users uid $g_uid)\" ]]; do g_uid=$[g_uid+1] done $dscl . -create /Users/\"$userA\" $dscl . -create /Users/\"$userA\" UserShell /bin/bash $dscl . -create /Users/\"$userA\" RealName " & longUser_name & " $dscl . -create /Users/\"$userA\" UniqueID $t_uid $dscl . -create /Users/\"$userA\" PrimaryGroupID $g_uid $dscl . -create /Users/\"$userA\" NFSHomeDirectory /Users/\"$userA\" $dscl . -passwd /Users/\"$userA\" " & T_password & " $dscl . -append /Groups/admin GroupMembership \"$userA\" /usr/sbin/createhomedir -l -u \"$userA\" /bin/echo \"Admin account: \"$userA\" successfully created\"" with administrator privileges display alert the result
So I am half way there, but what I would like to do is set limits on the new account. And allow the user access to only certain applications like safari, word, pages, ect…