Skip to content

Allowing users to be deleted from the system#318

Merged
twinkarma merged 8 commits intodevfrom
delete-user
Mar 31, 2023
Merged

Allowing users to be deleted from the system#318
twinkarma merged 8 commits intodevfrom
delete-user

Conversation

@twinkarma
Copy link
Copy Markdown
Collaborator

@twinkarma twinkarma commented Mar 10, 2023

  • Add interface in ServiceUser to allow deleting of user's personal information:
    • Add is_deleted flag for identifying deleted users
    • delete_user_personal_information - Replaces user's information with placeholder information. Username is replaced with deleted_[random hash string] both the prefix string and suffix hash length can be specified in the settings.
  • Database is changed so that a deleted user cascades to Project and Annotation i.e. all projects and annotations owned by the deleted user are removed
  • Add configuration flags to base.py with the default values:
    ALLOW_USER_DELETE = True  # Whether to allow deleting user and their associated projects and data
    DELETED_USER_USERNAME_PREFIX = "deleted"
    DELETED_USER_USERNAME_HASH_LENGTH = 8
    DELETED_USER_FIRSTNAME = "Deleted"
    DELETED_USER_LASTNAME = "Deleted"
    DELETED_USER_EMAIL_DOMAIN = "teamware-deleted.com"
    
  • Add rpcs for users and admins to remove personal info and wipe their account
    • Users: user_delete_personal_information and user_delete_account
    • Admins: admin_delete_user_personal_information and admin_delete_user
    • ALLOW_USER_DELETE settings must be true in order for the user_delete_account and admin_delete_user to work
  • Added a check to the login rpc so that accounts marked is_deleted cannot login, raises an AuthError
  • Added a initialise RPC that's called when the app starts, it gets the user auth/role information, their config and the global config (ALLOW_USER_DELETE)
    • Test the RPC
  • get_possible_annotators now excludes deleted users
    • Test the RPC
    • Add integration test to check that deleted user accounts are not listed
  • Add RPCs for deleting accounts
    • user_delete_personal_information
      • Add test
    • user_delete_account
      • Add test
    • admin_delete_user_personal_information
      • Add test
    • admin_delete_user
      • Add test
  • Add GUI for user deleting their own account
    • Add integration test for deleting account
    • Add integration test for wiping personal data only
  • Add GUI for admins to delete a user account
    • Add integration test for deleting account
    • Add integration test for wiping personal data only

@github-actions
Copy link
Copy Markdown

Jest Coverage

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 80 77.37 74.19 79.92
Details
File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 80 77.37 74.19 79.92
_src/components 77.14 77.35 85.71 77.14
_ AnnotationRenderer.vue 76.23 77.35 84 76.23 126,141-142,196,219,240,247-261,269,275-285,319
_ MarkdownEditor.vue 100 100 100 100
_ MarkdownRenderer.vue 100 100 100 100
_src/components/annotation 80.95 86.66 82.35 80.95
_ CheckboxInput.vue 85.71 100 100 85.71 19
_ HtmlDisplay.vue 80 100 100 80 26-30
_ InputErrorDisplay.vue 100 0 100 100 19-25
_ RadioInput.vue 85.71 100 100 85.71 19
_ SelectorInput.vue 71.42 100 66.66 71.42 20,27
_ TextInput.vue 75 100 66.66 75 26
_ TextareaInput.vue 66.66 100 50 66.66 20
_src/enum 100 100 100 100
_ DocumentTypes.js 100 100 100 100
_src/jrpc 90.32 83.33 75 90.32
_ index.js 90.32 83.33 75 90.32 29,38-39
_src/utils 77.77 74.6 38.46 77.46
_ annotations.js 96.55 81.25 100 96.42 35
_ dict.js 100 100 100 100
_ index.js 55.88 54.54 11.11 55.88 9-14,28-93
_tests/unit 100 100 100 100
_ globalVue.js 100 100 100 100

@twinkarma twinkarma requested a review from davidwyld March 24, 2023 16:02
@twinkarma twinkarma marked this pull request as ready for review March 27, 2023 12:04
Copy link
Copy Markdown
Contributor

@davidwyld davidwyld left a comment

Choose a reason for hiding this comment

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

Looks great! Nice one. Do we need some documentation?

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