-
Notifications
You must be signed in to change notification settings - Fork 83
Split admin and regular users in system-admin. Allow delete user #980
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. I'd like us to avoid introducing a new term though. "super user" should be "system admin" everywhere, including routing, to avoid confusion.
|
||
var form FormData | ||
err := controller.BindForm(w, r, &form) | ||
email := project.TrimSpace(form.Email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trimming and validation should happen in the model via a BeforeSave
, not the controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does also happen in BeforeSave, but FindUserByEmail needs the trim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not trim in FindUserByEmail
then?
var users []*User | ||
if err := db.db. | ||
Model(&User{}). | ||
Where("admin IS FALSE"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exclude admins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two pages: Admin users and Users. The delete action deletes the user here, but the admin users delete button just de-privileges the user by removing the admin bit.
I'm considering merging things or moving actions to a sub-page together, but for now I'm trying to keep them separate
Co-authored-by: Seth Vargo <seth@sethvargo.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sethvargo, whaught The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue ##975
Proposed Changes
Release Note