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

Seems there is no way to delete created users. #352

Closed
YuanTian1991 opened this issue May 25, 2021 · 8 comments
Closed

Seems there is no way to delete created users. #352

YuanTian1991 opened this issue May 25, 2021 · 8 comments

Comments

@YuanTian1991
Copy link
Collaborator

Though in theory, only Admin can add user, however, we still need a button to delete from user table. And delete the user-individual relationship table.

@pontikos
Copy link
Contributor

CRUD for "User Management" page needs to implemented

@alanwilter
Copy link
Collaborator

Indeed, we don't have an endpoint to delete users. I will create it.

@alanwilter
Copy link
Collaborator

I've almost finished it but now I'm starting to think why @priesgo may not have implemented that. He had implemented enable/disable user, perhaps, because we shouldn't delete users.
However, I can see the scenario where the user DOES want to quit the service and WANT all his/her related data deleted.
For the moment I considered only Admin to DELETE the user but I'd like to hear your opinions on this matter.

@pontikos
Copy link
Contributor

pontikos commented May 26, 2021

So I know that @IsmailM 's opinion on this is that users shoudl be disabled rather than deleted?

I think @dvarrazzo we can add an extra column to users table, for disabled true/false

Disabled users would not be able to login

@alanwilter
Copy link
Collaborator

@pontikos We already have this set:

phenopolis_db=> \d public.users
                            Table "public.users"
     Column     |           Type           | Collation | Nullable | Default
----------------+--------------------------+-----------+----------+---------
 user           | text                     |           | not null |
 argon_password | text                     |           |          |
 enabled        | boolean                  |           |          | false
 registered_on  | timestamp with time zone |           |          |
 confirmed      | boolean                  |           |          | false
 confirmed_on   | timestamp with time zone |           |          |
 email          | text                     |           |          |
 full_name      | text                     |           |          |
Indexes:
    "users_pkey" PRIMARY KEY, btree ("user")
    "users_email_key" UNIQUE CONSTRAINT, btree (email)
    "users_user_key" UNIQUE CONSTRAINT, btree ("user")
Referenced by:
    TABLE "user_pagetable_colname" CONSTRAINT "user_pagetable_colname_user_fkey" FOREIGN KEY ("user") REFERENCES users("user")
Triggers:
    "public.users_audit_trg" AFTER INSERT OR DELETE OR UPDATE ON users FOR EACH ROW EXECUTE FUNCTION audit."public.users_fn"()

@pontikos
Copy link
Contributor

ok then that's easy right? delete user just sets enabled to false? @YuanTian1991 this makese sense right?

@pontikos
Copy link
Contributor

@alanwilter make sure only enabled users can log in

@alanwilter
Copy link
Collaborator

Yes, it is designed this way.

alanwilter added a commit that referenced this issue May 26, 2021
YuanTian1991 added a commit that referenced this issue May 28, 2021
* Delete user #352

* Only Admin and User itself can delete user

* Added button in each user profile to delete it, with a dialog warning. It works well.

Co-authored-by: YuanTian1991 <tianyuan1991hit@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants