nextcloud / circles

👪 Create groups with other users on a Nextcloud instance and share with them
GNU Affero General Public License v3.0
148 stars 48 forks source link

Using the OCC command to add a user to a circle #1200

Open Bolli84 opened 2 years ago

Bolli84 commented 2 years ago

Can somesome show me, how I can add a user to an circle by using the commandline? I tried the use off occ circles:members:add but I always get the response about singleID as error back.

Can someone show me the correct line and how to find the value? Second: How can I change an owner by the commandline?

gonzalo commented 1 year ago

A bit late but maybe can be useful to other people with the same problem. For me the issue was to specify --type on command. If this is mandatory it should be mentioned on help page

occ circles:members:add --type=user $_circleId $_username

To promote a user you need their member id. You can get it from occ and pipe to into jq to get the specific memberid.

_memberId=$(occ circles:members:list --output=json ${_circleId} | jq ".[] | select(.userId==\"${_username}\")" | jq ' .id')

...and then....

occ circles:members:level ${_memberId} admin

(use admin or owner or whatever you want to set)