Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit 07b39be

Browse files
Fixed #32, a task can now contain a flag field master which send the task to the node from the users organization. (it will fail in case there is no node).
1 parent d336d9c commit 07b39be

File tree

1 file changed

+8
-0
lines changed
  • pytaskmanager/server/resource

1 file changed

+8
-0
lines changed

pytaskmanager/server/resource/task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ def post(self):
8585
org_ids = data.get('organization_ids', [])
8686
db_ids = collaboration.get_organization_ids()
8787

88+
# TODO what happens if user's organization does not have a node that
89+
# is part of a the collaboration
90+
# if the 'master'-flag is set to true the (master) task is executed on
91+
# a node in the collaboration from the organization to which the user
92+
# belongs. If also organization_ids are supplied, then these are ignored.
93+
if data.get("master", False) and g.user:
94+
org_ids = [g.user.organization_id]
95+
8896
if not all([org_id in db_ids for org_id in org_ids]):
8997
return {"msg": f"At least one of the supplied organizations in not within the collaboration"},\
9098
HTTPStatus.BAD_REQUEST

0 commit comments

Comments
 (0)