Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent user to triger a downlaod csv task if task details api inaccessible #156

Conversation

tehreem-sadat
Copy link
Collaborator

@tehreem-sadat tehreem-sadat commented Nov 27, 2024

Issue: #152

@tehreem-sadat tehreem-sadat force-pushed the tehreem/prevent_user_to_triger_task_if_task_details_inaccessible branch 3 times, most recently from 49acfed to fa11b33 Compare November 28, 2024 05:50
Copy link
Collaborator

@shadinaif shadinaif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tehreem-sadat , I'm asking to move the check to become the first one in list method. Please update it and it's good to go

Comment on lines 114 to 119
if not self.request.fx_permission_info['download_allowed']: # type: ignore[attr-defined]
return Response(
{'detail': 'You are not permitted to use the "download" parameter'},
status=http_status.HTTP_403_FORBIDDEN
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move this check to become the first one

request.fx_permission_info = {
'user': request.user,
'user_roles': user_roles,
'is_system_staff_user': system_staff_user_flag,
'view_allowed_roles': view_allowed_roles,
'view_allowed_tenant_ids_any_access': tenant_ids,
'download_allowed': download_allowed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'download_allowed': download_allowed
'download_allowed': download_allowed,

}

if system_staff_user_flag:
request.fx_permission_info.update({
'user_roles': {},
'download_allowed': True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'download_allowed': True
'download_allowed': True,

@tehreem-sadat tehreem-sadat force-pushed the tehreem/prevent_user_to_triger_task_if_task_details_inaccessible branch from fa11b33 to d037808 Compare November 28, 2024 08:25
@tehreem-sadat tehreem-sadat force-pushed the tehreem/prevent_user_to_triger_task_if_task_details_inaccessible branch from d037808 to 554cc3c Compare November 28, 2024 08:26
@tehreem-sadat tehreem-sadat merged commit f156499 into main Nov 28, 2024
3 checks passed
@tehreem-sadat tehreem-sadat deleted the tehreem/prevent_user_to_triger_task_if_task_details_inaccessible branch November 28, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants