add workspaces to user
This commit is contained in:
@@ -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+"'"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user