Created
January 16, 2013 16:45
-
-
Save will-moore/4548712 to your computer and use it in GitHub Desktop.
Using psql to add a user to a group in OMERO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get the ID of the 'user' group: | |
omero=# select * from experimentergroup where name='user'; | |
id | description | permissions | name | version | external_id | |
----+-------------+-------------+------+---------+------------- | |
1 | | -52 | user | 0 | | |
Get the ID of the Experimenter you want, using login name: | |
omero=# select * from experimenter where omename='root'; | |
id | permissions | email | firstname | institution | lastname | middlename | omename | version | external_id | |
----+-------------+-------+-----------+-------------+----------+------------+---------+---------+------------- | |
0 | 0 | | root | | root | | root | 0 | | |
(1 row) | |
Show all the groups that the Experimenter 'child' is in (won't include 'user' group parent=1) | |
omero=# select * from groupexperimentermap where child=0; | |
id | permissions | owner | version | child | external_id | parent | child_index | |
------+-------------+-------+---------+-------+-------------+--------+------------- | |
1 | -35 | f | 0 | 0 | | 0 | 1 | |
5 | -103 | f | 0 | 0 | | 5 | 0 | |
4 | -103 | f | 0 | 0 | | 4 | 2 | |
Add Experimenter (child=0) to Group (parent=1). NB child_index should be the next highest index in the query above. | |
In this case child_index = 3 (we already have 0,1,2) | |
omero=# insert into groupexperimentermap (id, permissions, owner, parent, child, child_index) values (ome_nextval('seq_groupexperimentermap'), -52, false, 1, 0, 3); | |
Now you should be able to see that Experimenter 0 (root) is in Group 1 (user) | |
omero=# select * from groupexperimentermap where child=0 and parent=1; | |
id | permissions | owner | version | child | external_id | parent | child_index | |
------+-------------+-------+---------+-------+-------------+--------+------------- | |
1755 | -52 | f | | 0 | | 1 | 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment