Hi,
is any way to add or create bulk user id's creation in omero ? more than 40 user in single file in csv or excel formats to omero id creation
thanks
bulk-user1,Albert,A.,bulk-groups,abc123
bulk-user2,Barbara,B.,bulk-groups,def456
#!/usr/bin/env python
import omero
import omero.cli
import fileinput
with omero.cli.cli_login() as cli:
for line in fileinput.input():
line = line.strip()
parts = line.split(",")
assert len(parts) == 5
omeName, firstName, lastName, groupName, password = parts
cli.invoke(["-q", "user", "add", "--ignore-existing",
omeName, firstName, lastName, groupName,
"--userpassword", password],
strict=True)
$ bin/omero login root@localhost
Created session for root@localhost:4064. Idle timeout: 10 min. Current group: system
$ bin/omero group add bulk-groups
Added group bulk-groups (id=4) with permissions rw----
$ PYTHONPATH=lib/python ./bulk.py bulk.csv
Added user bulk-user1 (id=3) with password
Added user bulk-user2 (id=4) with password
$ PYTHONPATH=lib/python ./bulk.py bulk.csv
User exists: bulk-user1 (id=3)
User exists: bulk-user2 (id=4)
omero@ubuntu-14:~/OMERO.server$ PYTHONPATH=lib/python ./bulk.py bulk.csv
Traceback (most recent call last):
File "./bulk.py", line 6, in <module>
with omero.cli.cli_login() as cli:
AttributeError: 'module' object has no attribute 'cli_login'
#!/usr/bin/env bash
set -e
set -u
CSVFILE="$1"
omero login
IFS=","
while read omeName firstName lastName groupName password
do
omero -q user add --ignore-existing \
"$omeName" "$firstName" "$lastName" "$groupName" \
--userpassword "$password"
done < "$CSVFILE"
$ export PATH=$PATH:/opt/omero/server/OMERO.server/bin/
$ ./bulk.sh bulk.csv
Previous session expired for root on localhost:4064
Server: [localhost:4064]
Username: [root]
Password:
Created session for root@localhost:4064. Idle timeout: 10 min. Current group: system
User exists: bulk-user1 (id=3)
User exists: bulk-user2 (id=4)
Return to Installation and Deployment
Users browsing this forum: No registered users and 1 guest