Skip to content

Commit 0bbf1e7

Browse files
committed
feat: add role argument to access command
1 parent ea4e83b commit 0bbf1e7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gigalixir/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ def delete_config(ctx, app_name, key):
976976
# @create.command()
977977
@cli.command(name='access:add')
978978
@click.option('-a', '--app_name', envvar="GIGALIXIR_APP")
979+
@click.option('--role', default="COLLABORATOR", help="Role of the user. Can be either 'COLLABORATOR' or 'VIEWER'.")
979980
@click.argument('email')
980981
@click.pass_context
981982
@report_errors
@@ -984,7 +985,7 @@ def add_permission(ctx, app_name, email):
984985
"""
985986
Grants a user permission to deploy an app.
986987
"""
987-
gigalixir_permission.create(ctx.obj['session'], app_name, email)
988+
gigalixir_permission.create(ctx.obj['session'], app_name, email, role)
988989

989990

990991
@cli.command(name='pg:psql')

gigalixir/permission.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ def get(session, app_name):
1515
data = json.loads(r.text)["data"]
1616
presenter.echo_json(data)
1717

18-
def create(session, app_name, email):
18+
def create(session, app_name, email, role):
1919
r = session.post('/api/apps/%s/permissions' % (quote(app_name.encode('utf-8'))), json = {
2020
"email": email,
21+
"role": role,
2122
})
2223
if r.status_code != 201:
2324
if r.status_code == 401:

0 commit comments

Comments
 (0)