remove permission from access decorator exception args

This commit is contained in:
dandds 2019-03-21 19:04:58 -04:00
parent 828d46bae9
commit 905f03342d
4 changed files with 7 additions and 11 deletions

View File

@ -8,12 +8,8 @@ from atst.domain.task_orders import TaskOrders
from atst.domain.exceptions import UnauthorizedError from atst.domain.exceptions import UnauthorizedError
def evaluate_exceptions(user, permission, exceptions, **kwargs): def evaluate_exceptions(user, exceptions, **kwargs):
return ( return True if True in [exc(user, **kwargs) for exc in exceptions] else False
True
if True in [exc(user, permission, **kwargs) for exc in exceptions]
else False
)
def check_access(permission, message, exceptions, *args, **kwargs): def check_access(permission, message, exceptions, *args, **kwargs):
@ -28,7 +24,7 @@ def check_access(permission, message, exceptions, *args, **kwargs):
access_args["portfolio"] = task_order.portfolio access_args["portfolio"] = task_order.portfolio
if exceptions and evaluate_exceptions( if exceptions and evaluate_exceptions(
g.current_user, permission, exceptions, **access_args, **kwargs g.current_user, exceptions, **access_args, **kwargs
): ):
return True return True

View File

@ -97,7 +97,7 @@ def update_application(portfolio_id, application_id):
def wrap_environment_role_lookup( def wrap_environment_role_lookup(
user, _perm, portfolio_id=None, environment_id=None, **kwargs user, portfolio_id=None, environment_id=None, **kwargs
): ):
env_role = EnvironmentRoles.get(user.id, environment_id) env_role = EnvironmentRoles.get(user.id, environment_id)
if not env_role: if not env_role:

View File

@ -89,7 +89,7 @@ def view_task_order(portfolio_id, task_order_id):
) )
def wrap_check_is_ko_or_cor(user, _perm, task_order_id=None, **_kwargs): def wrap_check_is_ko_or_cor(user, task_order_id=None, **_kwargs):
task_order = TaskOrders.get(task_order_id) task_order = TaskOrders.get(task_order_id)
Authorization.check_is_ko_or_cor(user, task_order) Authorization.check_is_ko_or_cor(user, task_order)
@ -290,7 +290,7 @@ def so_review_form(task_order):
return DD254Form(data=form_data) return DD254Form(data=form_data)
def wrap_check_is_so(user, _perm, task_order_id=None, **_kwargs): def wrap_check_is_so(user, task_order_id=None, **_kwargs):
task_order = TaskOrders.get(task_order_id) task_order = TaskOrders.get(task_order_id)
Authorization.check_is_so(user, task_order) Authorization.check_is_so(user, task_order)

View File

@ -20,7 +20,7 @@ def find_unsigned_ko_to(task_order_id):
return task_order return task_order
def wrap_check_is_ko(user, _perm, task_order_id=None, **_kwargs): def wrap_check_is_ko(user, task_order_id=None, **_kwargs):
task_order = TaskOrders.get(task_order_id) task_order = TaskOrders.get(task_order_id)
Authorization.check_is_ko(user, task_order) Authorization.check_is_ko(user, task_order)