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

Jlc/change staff admin msg pipeline #113

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

johanseto
Copy link
Collaborator

@johanseto johanseto commented Dec 11, 2023

Description

refactor: change pipelien auth exception to 403

Testing instructions

Use a Saml flow using a staff and admin user.
Check the authentication msg.

Before

Peek 2023-12-11 16-29

After

English

Peek 2023-12-11 16-35

Arabic

Peek 2023-12-11 16-37

Additional information

Jira story
https://edunext.atlassian.net/browse/FUTUREX-641?atlOrigin=eyJpIjoiNmI0MTAyNzBjMjM4NDZiNjgyMTk4MDM5MjM3ZjViODUiLCJwIjoiaiJ9

Checklist for Merge

  • Tested in a remote environment
  • Updated documentation
  • Rebased master/main
  • Squashed commits

@johanseto johanseto force-pushed the jlc/change-staff-admin-msg-pipeline branch 2 times, most recently from 06ff176 to 59f8391 Compare December 11, 2023 18:39
@johanseto johanseto marked this pull request as ready for review December 11, 2023 21:51
pipe_output = safer_associate_username_by_uid(backend, self.details, self.response, user=self.user)
pipe_output = safer_associate_username_by_uid(
self.request, self.backend, self.details, self.response, user=self.user,
)

self.assertEqual(None, pipe_output)
Copy link
Collaborator

@andrey-canon andrey-canon Dec 12, 2023

Choose a reason for hiding this comment

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

Suggested change
self.assertEqual(None, pipe_output)
self.assertIsNone(pipe_output)

@@ -60,17 +63,21 @@ def test_staff_user_raise_exc(self, user_kwargs):
"""Test the pipeline method try to match with uid, the user with matched username exists
but is staff or superuser.
Expected behavior:
- Raise EoxNelpAuthException exception
- The pipe return an HttpResponseForbidden object.
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
- The pipe return an HttpResponseForbidden object.
- The pipeline returns an HttpResponseForbidden object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here I have some doubts I mean pipeline is not the list of pipes ?
and a pipe is only for one related to a function?
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense, however it's the first time that I see that someone uses pipe to refer to a single process, that make s me think about the Unix pipe symbol |

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thing that could be used in that way. The unix pipe operator is used to connect, but here the pipes also changes the process in the interconnection xD.
A pipe is a method used to pass information from one program process to another. Unlike other types of interprocess communication, a pipe only offers one-way communication by passing a parameter or output from one process to another.
https://www.techopedia.com/definition/3410/pipe
https://www.geeksforgeeks.org/pipe-system-call/

Copy link
Collaborator

Choose a reason for hiding this comment

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

were you able to find any reference where someone call this pipe ? I think this make sense but that looks like a literal translation that nobody use

Copy link
Collaborator

Choose a reason for hiding this comment

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

anyway I don't want to get into semantic discussions IMO pipe is not a common term and I prefer something like pipeline method or function but it's up to you

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

eox_nelp/third_party_auth/tests/test_pipeline.py Outdated Show resolved Hide resolved
{
"page_header": _("It is not allowed to auto associate staff or admin users"),
"page_content": _(
"You can change permission for that user or try to check the signupsource of the user."
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm sure about the relation of the signupsource model here,anyway I prefer something like "You are trying to access with a user that already exists. Please try to authenticate on the site where you registered for the first time or contact support."

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

@johanseto johanseto force-pushed the jlc/change-staff-admin-msg-pipeline branch from d2ed708 to 865fb92 Compare December 13, 2023 19:53
This change the exception raised to a 403 msg.

refactor: update test to the response 403

This update the test to match the saml association with
a message in 403 forbidden view.

chore: pr assert recommendations

chore: pr change msg support

chore: pr feedback semantic
@johanseto johanseto force-pushed the jlc/change-staff-admin-msg-pipeline branch from 865fb92 to b4c89f0 Compare December 13, 2023 20:21
@johanseto johanseto merged commit 03ea4f2 into master Dec 13, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants