Use central definition of default admin group permissions
This commit is contained in:
parent
4a0bbb23bb
commit
bd6079ae4c
@ -20,6 +20,9 @@ from manage_extra.node_types.group_texture import node_type_group_texture
|
||||
log = logging.getLogger(__name__)
|
||||
blueprint = Blueprint('projects', __name__)
|
||||
|
||||
# Default project permissions for the admin group.
|
||||
DEFAULT_ADMIN_GROUP_PERMISSIONS = ['GET', 'PUT', 'POST', 'DELETE']
|
||||
|
||||
|
||||
def before_inserting_projects(items):
|
||||
"""Strip unwanted properties, that will be assigned after creation. Also,
|
||||
@ -148,7 +151,7 @@ def after_inserting_project(project, db_user):
|
||||
'users': [],
|
||||
'groups': [
|
||||
{'group': admin_group_id,
|
||||
'methods': ['GET', 'PUT', 'POST', 'DELETE']},
|
||||
'methods': DEFAULT_ADMIN_GROUP_PERMISSIONS[:]},
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,8 @@ def _default_permissions():
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
from application.modules.projects import DEFAULT_ADMIN_GROUP_PERMISSIONS
|
||||
|
||||
groups_collection = app.data.driver.db['groups']
|
||||
admin_group = groups_collection.find_one({'name': 'admin'})
|
||||
|
||||
@ -158,7 +160,7 @@ def _default_permissions():
|
||||
'users': [],
|
||||
'groups': [
|
||||
{'group': admin_group['_id'],
|
||||
'methods': ['GET', 'PUT', 'POST']},
|
||||
'methods': DEFAULT_ADMIN_GROUP_PERMISSIONS[:]},
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user