Managing groups
Groups are the recommended way to share data with several users, see organizing . This page walks through managing them: adding newly joined users, removing users, leaving a group yourself, and who may hand out access in the first place. To share single elements, see sharing . For the rules behind it, see the access .
Adding newly joined users to a group
Adding a user to a group creates an IS_IN_GROUP relation from the user to the group. You need to be able to read the user (nothing else), and to own the group or hold every access to it, including HAS_GOVERN_ACCESS:
curl \ -H 'Authorization: Bearer secret-token:IeW0rLWBvJkXM30HeH2sjB' \ -H 'Content-Type: application/json' \ -d '{ "type": "IS_IN_GROUP", "start": "02IiNr0FNRCl5tn3DxgbY5BR25NfQsfQ6l3mK", "end": "02IiNr0FNRCl5tH1sttbC0lL6rDN2CsNLPlHg" }' \ https://api.example.com/HTTP/1.1 201 CreatedFrom then on the user has all rights the group has: members read and create inside of the group, and everything the group owns or has been granted is available to them. Members can not hand out access to the group, as membership alone never includes HAS_GOVERN_ACCESS. Members do not get update or delete access to the group node either.
If you can not see the new user, ask them to share their user node with a group both of you are in, for example by creating HAS_READ_ACCESS from that group to their own user node. Users own their own user node, so they are always allowed to do this.
Removing users from groups
Removing a user from a group deletes the IS_IN_GROUP relation. First find the relation, for example with on the user, which returns the user’s relations and nodes:
curl \ -H 'Authorization: Bearer secret-token:PIPeJGUt7c00ENn8a5uDlc' \ 'https://api.example.com/<uuid of the user>/related'Then delete the relation with :
curl -X DELETE \ -H 'Authorization: Bearer secret-token:WN4gZM3Ev2QU6ADS0hPF6m' \ https://api.example.com/02IiNr0FNRCl5yxwcGCtfo2LJLPd4aufELUgnHTTP/1.1 204 No ContentYou can delete the relation if you can see both the user and the group, and own the group or hold HAS_GOVERN_ACCESS to it. If you can see the relation but may not delete it, the answer is 403; relations of which you can not see both nodes do not exist for you and are answered with 404. The same goes for every other grant relation: whoever holds HAS_GOVERN_ACCESS to the element can revoke access to it, as long as they can see the relation, i.e. both of its nodes. Relations of which you can see at most one node do not exist for you.
Groups can be nested: a group can be a member of another group with IS_IN_GROUP, and users inherit what the outer groups have. A user can therefore have access to a group through several IS_IN_GROUP chains. Deleting one IS_IN_GROUP relation only removes that chain: if the user is still a member of the group through another group, or the inner group is still a member, the access stays. To revoke access completely, delete every chain, i.e. the user’s direct memberships and, if necessary, the memberships of the groups in between. Relations between groups can be deleted like those of users, if you can see both groups and own the outer group or hold HAS_GOVERN_ACCESS to it.
Removing a membership or a grant does not cascade. If somebody has passed on access they received, the access of the person they passed it on to stays untouched until it is revoked as well.
Users removing themselves from groups
Recipients can delete their own grants
A user can delete a relation which starts at their own user node, so they can leave a group or give up access without anybody’s help, as long as they can see the relation. They do not need to be able to hand out the access.
A user leaves a group by deleting their own IS_IN_GROUP relation, in the same way as in the previous section:
curl -X DELETE \ -H 'Authorization: Bearer secret-token:X6mAfP5NK6ZbgODOkf2iIm' \ https://api.example.com/02IiNr0FNRCl61YZCrE71vHKVG06pUGHvkKj8HTTP/1.1 204 No ContentThe same works for every other grant relation which starts at the user, e.g. HAS_READ_ACCESS; this does not need HAS_GOVERN_ACCESS.
Who may hand out access
Relations like OWNS, IS_IN_GROUP and HAS_<ACCESS>_ACCESS are grant relations: they confer rights over their end node. Therefore not everybody who can read or even update an element may hand out access to it. A user may create, change or delete grant relations pointing to an element if they
- own the element, or
- have been granted
HAS_GOVERN_ACCESSto it,
and, when creating or changing a grant, additionally hold the access which is handed out themselves: a user can only pass on what they have. OWNS and IS_IN_GROUP hand out everything, so they require everything.
The user who receives the access (the start node of the relation) only has to be readable for the user who hands out access; the recipient does not have to grant anything. Handing out access never gives the user any right to create elements inside of the recipient. Only OWNS is different, as it places the element inside of the start node and therefore requires create access to it.
Condition-free access is required
Access which is limited by conditions (onLabel, onParentLabel, onState, onCreatedByUser) can not be handed out, because the new grant would not be limited to the same elements anymore. A user who holds conditional access to an element can still use it, but only passes it on if they also hold the same access without conditions, e.g. through a parallel path.