The hubsec_new command for the hub will create a user with the acl for you. I have created a small script that will read a CSV file and creates the users in this list. The default password is changeme
The CSV is on the format username, fullname, description, profile, acl. All fields must be present (no default handling), comments start with either # or --
Remember to replace XXXXX with your administrator password.
Enjoy
Carstein
local nimpw = "XXXXX"
local csvfile = "new-user.csv"
local users = {}
nimbus.login("administrator",nimpw)
-- csv format:
-- username,fullname,descr,profile,acl
buf = file.read (csvfile)
ul = split(buf,"\n")
for i=1,#ul do
if not regexp (ul[i],"#*|--*") then -- Skip comment lines (starting with # or --)
f = split(ul[i],",")
users[i] = {}
users[i].username = trim(f[1])
users[i].fullname = trim(f[2])
users[i].description = trim(f[3])
users[i].password = "0FyNT/PyeMO6q0IOaodWCA==" -- password is: changeme
users[i].profile = trim(f[4])
users[i].acl = trim(f[5])
end
end
for i,u in pairs(users) do
local args = pds.create()
pds.putString (args,"_section", "users")
pds.putString (args,"_profile", u.username)
pds.putString (args,"fullname", u.fullname)
pds.putString (args,"description",u.description)
pds.putString (args,"password", u.password)
pds.putString (args,"profile", u.profile)
pds.putString (args,"acl", u.acl)
out,rc = nimbus.request ("hub","hubsec_new",args)
pds.delete (args)
printf ("Creating user '%s', status %d",u.username, rc)
end