Commit eaffcc4f authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

models/group.py: anon as a default permission when adding a new user

May close #3001.
parent 18ab49e9
Pipeline #195531 passed with stages
in 12 minutes and 36 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);
Supports Markdown
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