Commit c97212f7 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-s/3001-anon-by-default' into 'dev'

models/group.py: anon as a default permission for personal user groups

Closes #3001

See merge request !435
parents b299de1c eaffcc4f
Pipeline #199633 passed with stages
in 13 minutes and 26 seconds
......@@ -623,7 +623,7 @@ def user():
# Set up a new user, after register
# Default permissions
add_default_group_permissions(auth, auth.user_group())
add_default_group_permissions(auth, auth.user_group(), anon=True)
# Appartenance to the public group
group_id = db(db.auth_group.role == 'public').select()[0].id
......
def add_default_group_permissions(auth, group_id):
def add_default_group_permissions(auth, group_id, anon=False):
auth.add_permission(group_id, PermissionEnum.create.value, 'sample_set', 0);
auth.add_permission(group_id, PermissionEnum.read.value, 'sample_set', 0);
auth.add_permission(group_id, PermissionEnum.admin.value, 'sample_set', 0);
auth.add_permission(group_id, PermissionEnum.upload.value, 'sample_set', 0);
auth.add_permission(group_id, PermissionEnum.save.value, 'sample_set', 0);
if anon:
auth.add_permission(group_id, PermissionEnum.anon.value, 'sample_set', 0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment