Prevent 403 when user doesn't have access enough to fetch project users.
This commit is contained in:
@@ -5,6 +5,7 @@ import flask
|
|||||||
import flask_login
|
import flask_login
|
||||||
|
|
||||||
import pillarsdk
|
import pillarsdk
|
||||||
|
import pillarsdk.exceptions as sdk_exceptions
|
||||||
from pillar.web.system_util import pillar_api
|
from pillar.web.system_util import pillar_api
|
||||||
import pillar.api.utils
|
import pillar.api.utils
|
||||||
|
|
||||||
@@ -60,8 +61,11 @@ def view_task(project, attract_props, task_id):
|
|||||||
task = pillarsdk.Node.find(task_id, api=api)
|
task = pillarsdk.Node.find(task_id, api=api)
|
||||||
node_type = project.get_node_type(node_type_task['name'])
|
node_type = project.get_node_type(node_type_task['name'])
|
||||||
# Fetch project users so that we can assign them tasks
|
# Fetch project users so that we can assign them tasks
|
||||||
users = project.get_users(api=api)
|
try:
|
||||||
project.users = users['_items']
|
users = project.get_users(api=api)
|
||||||
|
project.users = users['_items']
|
||||||
|
except sdk_exceptions.ForbiddenAccess:
|
||||||
|
project.users = []
|
||||||
|
|
||||||
return render_template('attract/tasks/view_task_embed.html',
|
return render_template('attract/tasks/view_task_embed.html',
|
||||||
task=task,
|
task=task,
|
||||||
|
Reference in New Issue
Block a user