Migrate GORM to generics API, simplify user-domain relationship, refactor models
This commit is contained in:
parent
19ce2224b8
commit
560b40503a
9 changed files with 192 additions and 117 deletions
|
|
@ -270,22 +270,6 @@ func (h *UserHandler) Delete(c *gin.Context) {
|
|||
NoContent(c)
|
||||
}
|
||||
|
||||
func (h *UserHandler) ListAll(c *gin.Context) {
|
||||
authCtx := GetAuthContext(c)
|
||||
if authCtx == nil || !authCtx.IsAdmin() {
|
||||
Error(c, http.StatusForbidden, "admin access required")
|
||||
return
|
||||
}
|
||||
|
||||
users, err := h.db.GetAllMailUsers()
|
||||
if err != nil {
|
||||
Error(c, http.StatusInternalServerError, "database error")
|
||||
return
|
||||
}
|
||||
|
||||
Success(c, users)
|
||||
}
|
||||
|
||||
var emailLocalPartRegex = regexp.MustCompile("^[a-zA-Z0-9!#$%&'*+\\-=?^_~-]+$")
|
||||
|
||||
func validateEmailLocalPart(email string) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue