add workspaces to user

This commit is contained in:
Adrian Zürcher
2026-02-16 19:29:41 +01:00
parent 81959425a1
commit 3eb40bc02f
5 changed files with 49 additions and 44 deletions

View File

@@ -112,6 +112,10 @@ func (aH *AccessHandler) AddUser(c *gin.Context) {
return
}
if len(user.Workspaces) > 0 {
aH.dbHandler.AddRelation(&user, user.Workspaces, "Workspaces")
}
c.JSON(http.StatusOK, gin.H{
"message": fmt.Sprintf("user '%s' successfully added", user.Name),
})
@@ -200,6 +204,10 @@ func (aH *AccessHandler) UpdateUser(c *gin.Context) {
c.JSON(http.StatusInternalServerError, nil)
return
}
if len(user.Workspaces) > 0 {
aH.dbHandler.AddRelation(&user, user.Workspaces, "Workspaces")
}
c.JSON(http.StatusOK, models.NewJsonMessageResponse("successfully updated user '"+user.Email+"'"))
}