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

Disable account #344

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Disable account #344

wants to merge 4 commits into from

Conversation

BLEMENT33
Copy link
Contributor

Description

I created code to be able to delete accounts that do not have a Central address.
To do that, I :

  • Added a Boolean enabled attribute to the CoreUser
  • Added a CRUD to deactivate a CoreUser
  • Have prevented disabled CoreUsers from connecting

I still have to exclude deactivated CoreUsers from the search

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 79.41176% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 78.32%. Comparing base (3cb0984) to head (37fb85b).
Report is 12 commits behind head on main.

❗ Current head 37fb85b differs from pull request most recent head ceb1f52. Consider uploading reports for the commit ceb1f52 to get more accurate results

Files Patch % Lines
app/cruds/cruds_external_account.py 75.00% 3 Missing ⚠️
app/endpoints/auth.py 0.00% 2 Missing ⚠️
app/endpoints/users.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #344      +/-   ##
==========================================
+ Coverage   78.30%   78.32%   +0.01%     
==========================================
  Files          78       80       +2     
  Lines        5435     5467      +32     
==========================================
+ Hits         4256     4282      +26     
- Misses       1179     1185       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@armanddidierjean armanddidierjean left a comment

Choose a reason for hiding this comment

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

Nice module!

Comment on lines 16 to 19
"python.testing.pytestArgs": ["tests"],
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
Copy link
Member

Choose a reason for hiding this comment

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

Should this be changed?

if not user.enabled:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Disabled account. Contact eclair@myecl.fr for more informations.",
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to hard code an email in the API response?

Comment on lines 13 to 17
@router.get(
"/external/",
status_code=200,
tags=[Tags.external_account],
)
Copy link
Member

Choose a reason for hiding this comment

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

I think we could put the endpoint in users.py

@@ -35,6 +35,7 @@ class CoreUser(Base):
phone: Mapped[str | None] = mapped_column(String)
floor: Mapped[FloorsType] = mapped_column(Enum(FloorsType), nullable=False)
created_on: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
enabled: Mapped[bool] = mapped_column(Boolean, nullable=False)
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of disabled?

@armanddidierjean armanddidierjean marked this pull request as draft February 29, 2024 16:06
@armanddidierjean armanddidierjean changed the title External account Disable account Mar 15, 2024
@BLEMENT33 BLEMENT33 linked an issue Mar 16, 2024 that may be closed by this pull request
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.

Delete old external students
2 participants