From ba79a308464396fb24ef3bac865e1715c32e4d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 15 Jun 2016 13:01:43 +0200 Subject: [PATCH] Removed an assumption that project creator is project owner. This assumption may still exist in other parts of the application, though. --- pillar/application/modules/projects.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pillar/application/modules/projects.py b/pillar/application/modules/projects.py index 55ffc3ca..cb24e09e 100644 --- a/pillar/application/modules/projects.py +++ b/pillar/application/modules/projects.py @@ -102,21 +102,21 @@ def protect_sensitive_fields(document, original): revert('user') -def after_inserting_projects(items): +def after_inserting_projects(projects): """After inserting a project in the collection we do some processing such as: - apply the right permissions - define basic node types - optionally generate a url - initialize storage space - :param items: List of project docs that have been inserted (normally one) + :param projects: List of project docs that have been inserted (normally one) """ - current_user = g.current_user - users_collection = current_app.data.driver.db['users'] - user = users_collection.find_one(current_user['user_id']) - for item in items: - after_inserting_project(item, user) + users_collection = current_app.data.driver.db['users'] + for project in projects: + owner_id = project.get('user', None) + owner = users_collection.find_one(owner_id) + after_inserting_project(project, owner) def after_inserting_project(project, db_user):