Removed an assumption that project creator is project owner.
This assumption may still exist in other parts of the application, though.
This commit is contained in:
parent
b4faf2245e
commit
ba79a30846
@ -102,21 +102,21 @@ def protect_sensitive_fields(document, original):
|
|||||||
revert('user')
|
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:
|
"""After inserting a project in the collection we do some processing such as:
|
||||||
- apply the right permissions
|
- apply the right permissions
|
||||||
- define basic node types
|
- define basic node types
|
||||||
- optionally generate a url
|
- optionally generate a url
|
||||||
- initialize storage space
|
- 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:
|
users_collection = current_app.data.driver.db['users']
|
||||||
after_inserting_project(item, user)
|
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):
|
def after_inserting_project(project, db_user):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user