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

feat: Ensures related access is deleted after user/device deletion #76

Merged
merged 9 commits into from
Dec 2, 2020

Conversation

frgfm
Copy link
Member

@frgfm frgfm commented Nov 29, 2020

This PR ensures that once a user or a device is deleted, its corresponding access is deleted as well.

I had to change the table definitions in unittests since accesses were sometimes not consistent with device/user tables.

@frgfm frgfm added this to the 0.1.1 milestone Nov 29, 2020
@frgfm frgfm self-assigned this Nov 29, 2020
src/app/api/routes/devices.py Outdated Show resolved Hide resolved
src/app/api/routes/users.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 30, 2020

Codecov Report

Merging #76 (b701b75) into master (129ff9d) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   91.36%   91.41%   +0.05%     
==========================================
  Files          23       23              
  Lines         683      687       +4     
==========================================
+ Hits          624      628       +4     
  Misses         59       59              
Flag Coverage Δ
unittests 91.41% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/app/db/tables.py 100.00% <ø> (ø)
src/app/api/routes/devices.py 100.00% <100.00%> (ø)
src/app/api/routes/users.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 129ff9d...b701b75. Read the comment docs.

Copy link
Contributor

@florianriche florianriche left a comment

Choose a reason for hiding this comment

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

I just have a comment that is a question/Warning. If my comment is useless, then let's merge this PR

EDIT: Should we not delete user/device when deleting an access as well?

src/tests/conftest.py Show resolved Hide resolved
@frgfm
Copy link
Member Author

frgfm commented Dec 2, 2020

I just have a comment that is a question/Warning. If my comment is useless, then let's merge this PR

EDIT: Should we not delete user/device when deleting an access as well?

I wondered as well, but I felt it was quite dangerous. Only admin should be able to delete accesses directly, so I thought that self deletion of user/device should trigger the deletion of their access, but the other way is quite dangerous. But if you have a suggestion, happy to check it!

@frgfm frgfm merged commit cb44eb3 into master Dec 2, 2020
@frgfm frgfm deleted the user-del branch December 2, 2020 09:59
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