Add user to another users project via CLI


Is it still possible to use the “cryosparcm cli add_project_user_access” command to add a user to another users project? I keep getting the following errors when using the command on V3.1.0

cryosparcm cli “add_project_user_access(project_uid, requester_user_id, add_user_id)”
-bash: syntax error near unexpected token `(’

cryosparcm icli
add_project_user_access(project_uid, requester_user_id, add_user_id)

NameError: name ‘add_project_user_access’ is not defined

Hi @Paul, it looks like your first try did not work because of an error in your bash command. Please use double quotes to wrap the command, and double-quotes to wrap each function argument.

Also try the get_id_by_email command to determine the cryoSPARC user ID you need to authorize access.

Enter the following commands - substitute <owner-email> for the email address of either an admin or the user that owns the project, and substitute <target-email> for the user that you’d like to add to a project. Use the resulting output result1 and result2 from the first two lines in the third command. Substitute Px for the project UID of target project.

cryosparcm cli "get_id_by_email('<owner-email>')" 
cryosparcm cli "get_id_by_email('<target-email>')"
cryosparcm cli "add_project_user_access('Px', 'result1', 'result2')"

Example run:

$ cryosparcm cli "get_id_by_email('')" 

$ cryosparcm cli "get_id_by_email('')"

$ cryosparcm cli "add_project_user_access('P3', '5e287fadd538b84e14fc8b37', '5e2b4240d538b84e989b1824')"
1 Like

Also note that to use cryosparcm icli, you must prefix each command with cli.:

$ cryosparcm icli
Type 'copyright', 'credits' or 'license' for more information
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.

 connecting to host:39002 ...
 cli, rtp, db, gfs and tools ready to use

In [1]: cli.add_project_user_access('P3', '5e287fadd538b84e14fc8b37', '5e2b4240d538b84e989b1824')

In [2]: 
1 Like

Thanks @nfrasser, this has resolved the issue for me and hopefully help anyone else having an issue using this command.

1 Like