Node 'user' property now defaults to the current user ID.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
|
||||
from bson import ObjectId
|
||||
from flask import current_app
|
||||
from flask import current_app, g
|
||||
from werkzeug.exceptions import UnprocessableEntity
|
||||
|
||||
from application.modules import file_storage
|
||||
@@ -116,6 +116,9 @@ def before_inserting_nodes(items):
|
||||
if project:
|
||||
item['project'] = project['_id']
|
||||
|
||||
# Default the 'user' property to the current user.
|
||||
item.setdefault('user', g.current_user['user_id'])
|
||||
|
||||
|
||||
def after_inserting_nodes(items):
|
||||
for item in items:
|
||||
|
@@ -304,7 +304,6 @@ nodes_schema = {
|
||||
},
|
||||
'user': {
|
||||
'type': 'objectid',
|
||||
'required': True,
|
||||
'data_relation': {
|
||||
'resource': 'users',
|
||||
'field': '_id',
|
||||
|
Reference in New Issue
Block a user