|
|
@@ -11,13 +11,13 @@ import ( |
|
|
|
func AddRole(ctx *context.APIContext, form models.AddRoleReq) { |
|
|
|
user, err := models.GetUserByName(form.UserName) |
|
|
|
if err != nil { |
|
|
|
ctx.JSON(http.StatusOK, response.ServerError("User not exists")) |
|
|
|
ctx.JSON(http.StatusOK, response.OuterServerError("User not exists")) |
|
|
|
return |
|
|
|
} |
|
|
|
err = role.AddUserRole(user.ID, form.RoleType) |
|
|
|
if err != nil { |
|
|
|
ctx.JSON(http.StatusOK, response.ResponseError(err)) |
|
|
|
ctx.JSON(http.StatusOK, response.OuterResponseError(err)) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.JSON(http.StatusOK, response.Success()) |
|
|
|
ctx.JSON(http.StatusOK, response.OuterSuccess()) |
|
|
|
} |