swag fmt
This commit is contained in:
@@ -10,12 +10,12 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary Get all resources
|
// @Summary Get all resources
|
||||||
// @Tags acl/resources
|
// @Tags acl/resources
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} getResourcesResponse
|
// @Success 200 {object} getResourcesResponse
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/resources [get]
|
// @Router /api/acl/resources [get]
|
||||||
func (h *aclAdminHandler) getResources(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getResources(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -44,15 +44,15 @@ func (h *aclAdminHandler) getResources(w http.ResponseWriter, r *http.Request) {
|
|||||||
_ = json.NewEncoder(w).Encode(resp)
|
_ = json.NewEncoder(w).Encode(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Get resource by ID
|
// @Summary Get resource by ID
|
||||||
// @Tags acl/resources
|
// @Tags acl/resources
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param resourceId path int true "Resource ID" example(1)
|
// @Param resourceId path int true "Resource ID" example(1)
|
||||||
// @Success 200 {object} getResourceResponse
|
// @Success 200 {object} getResourceResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/resources/{resourceId} [get]
|
// @Router /api/acl/resources/{resourceId} [get]
|
||||||
func (h *aclAdminHandler) getResource(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getResource(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -83,16 +83,16 @@ func (h *aclAdminHandler) getResource(w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Create resource
|
// @Summary Create resource
|
||||||
// @Tags acl/resources
|
// @Tags acl/resources
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param request body createResourceRequest true "Resource"
|
// @Param request body createResourceRequest true "Resource"
|
||||||
// @Success 201 {object} createResourceResponse
|
// @Success 201 {object} createResourceResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/resources [post]
|
// @Router /api/acl/resources [post]
|
||||||
func (h *aclAdminHandler) createResource(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) createResource(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -127,18 +127,18 @@ func (h *aclAdminHandler) createResource(w http.ResponseWriter, r *http.Request)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Update resource
|
// @Summary Update resource
|
||||||
// @Tags acl/resources
|
// @Tags acl/resources
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param resourceId path int true "Resource ID" example(1)
|
// @Param resourceId path int true "Resource ID" example(1)
|
||||||
// @Param request body updateResourceRequest true "Resource"
|
// @Param request body updateResourceRequest true "Resource"
|
||||||
// @Success 200 {object} updateResourceResponse
|
// @Success 200 {object} updateResourceResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/resources/{resourceId} [patch]
|
// @Router /api/acl/resources/{resourceId} [patch]
|
||||||
func (h *aclAdminHandler) updateResource(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) updateResource(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -181,16 +181,16 @@ func (h *aclAdminHandler) updateResource(w http.ResponseWriter, r *http.Request)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Delete resource
|
// @Summary Delete resource
|
||||||
// @Tags acl/resources
|
// @Tags acl/resources
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param resourceId path int true "Resource ID" example(1)
|
// @Param resourceId path int true "Resource ID" example(1)
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/resources/{resourceId} [delete]
|
// @Router /api/acl/resources/{resourceId} [delete]
|
||||||
func (h *aclAdminHandler) deleteResource(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) deleteResource(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary Get all roles
|
// @Summary Get all roles
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} getRolesResponse
|
// @Success 200 {array} getRolesResponse
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles [get]
|
// @Router /api/acl/roles [get]
|
||||||
func (h *aclAdminHandler) getRoles(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getRoles(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roles, err := h.a.GetRoles()
|
roles, err := h.a.GetRoles()
|
||||||
@@ -43,15 +43,15 @@ func (h *aclAdminHandler) getRoles(w http.ResponseWriter, r *http.Request) {
|
|||||||
_ = json.NewEncoder(w).Encode(resp)
|
_ = json.NewEncoder(w).Encode(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Get role by ID
|
// @Summary Get role by ID
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Success 200 {object} getRoleResponse
|
// @Success 200 {object} getRoleResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId} [get]
|
// @Router /api/acl/roles/{roleId} [get]
|
||||||
func (h *aclAdminHandler) getRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
@@ -81,15 +81,15 @@ func (h *aclAdminHandler) getRole(w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Get role users
|
// @Summary Get role users
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Success 200 {array} getRoleUsersResponse
|
// @Success 200 {array} getRoleUsersResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId}/users [get]
|
// @Router /api/acl/roles/{roleId}/users [get]
|
||||||
func (h *aclAdminHandler) getRoleUsers(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getRoleUsers(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
@@ -127,15 +127,15 @@ func (h *aclAdminHandler) getRoleUsers(w http.ResponseWriter, r *http.Request) {
|
|||||||
_ = json.NewEncoder(w).Encode(respUsers)
|
_ = json.NewEncoder(w).Encode(respUsers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Get role resources
|
// @Summary Get role resources
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Success 200 {array} getRoleResourcesResponse
|
// @Success 200 {array} getRoleResourcesResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId}/resources [get]
|
// @Router /api/acl/roles/{roleId}/resources [get]
|
||||||
func (h *aclAdminHandler) getRoleResources(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getRoleResources(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
@@ -171,16 +171,16 @@ func (h *aclAdminHandler) getRoleResources(w http.ResponseWriter, r *http.Reques
|
|||||||
_ = json.NewEncoder(w).Encode(respResources)
|
_ = json.NewEncoder(w).Encode(respResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Create role
|
// @Summary Create role
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param request body createRoleRequest true "Role"
|
// @Param request body createRoleRequest true "Role"
|
||||||
// @Success 201 {object} createRoleResponse
|
// @Success 201 {object} createRoleResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles [post]
|
// @Router /api/acl/roles [post]
|
||||||
func (h *aclAdminHandler) createRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) createRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -213,18 +213,18 @@ func (h *aclAdminHandler) createRole(w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Update role
|
// @Summary Update role
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Param request body updateRoleRequest true "Role"
|
// @Param request body updateRoleRequest true "Role"
|
||||||
// @Success 200 {object} updateRoleResponse
|
// @Success 200 {object} updateRoleResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId} [patch]
|
// @Router /api/acl/roles/{roleId} [patch]
|
||||||
func (h *aclAdminHandler) updateRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) updateRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
@@ -265,16 +265,16 @@ func (h *aclAdminHandler) updateRole(w http.ResponseWriter, r *http.Request) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Delete role
|
// @Summary Delete role
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId} [delete]
|
// @Router /api/acl/roles/{roleId} [delete]
|
||||||
func (h *aclAdminHandler) deleteRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) deleteRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
@@ -303,17 +303,17 @@ func (h *aclAdminHandler) deleteRole(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Assign resource to role
|
// @Summary Assign resource to role
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Param request body assignResourceToRoleRequest true "Resource"
|
// @Param request body assignResourceToRoleRequest true "Resource"
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId}/resources [post]
|
// @Router /api/acl/roles/{roleId}/resources [post]
|
||||||
func (h *aclAdminHandler) assignResourceToRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) assignResourceToRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
@@ -346,16 +346,16 @@ func (h *aclAdminHandler) assignResourceToRole(w http.ResponseWriter, r *http.Re
|
|||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Remove resource from role
|
// @Summary Remove resource from role
|
||||||
// @Tags acl/roles
|
// @Tags acl/roles
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Param resId path int true "Resource ID" example(1)
|
// @Param resId path int true "Resource ID" example(1)
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/roles/{roleId}/resources/{resId} [delete]
|
// @Router /api/acl/roles/{roleId}/resources/{resId} [delete]
|
||||||
func (h *aclAdminHandler) removeResourceFromRole(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) removeResourceFromRole(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
roleIDStr := chi.URLParam(r, "roleId")
|
roleIDStr := chi.URLParam(r, "roleId")
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary Get user roles by user ID
|
// @Summary Get user roles by user ID
|
||||||
// @Tags acl/users
|
// @Tags acl/users
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param userId path int true "User ID" example(1)
|
// @Param userId path int true "User ID" example(1)
|
||||||
// @Success 200 {object} getUserRolesResponse
|
// @Success 200 {object} getUserRolesResponse
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/users/{userId}/roles [get]
|
// @Router /api/acl/users/{userId}/roles [get]
|
||||||
func (h *aclAdminHandler) getUserRoles(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) getUserRoles(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
userIDStr := chi.URLParam(r, "userId")
|
userIDStr := chi.URLParam(r, "userId")
|
||||||
@@ -49,17 +49,17 @@ func (h *aclAdminHandler) getUserRoles(w http.ResponseWriter, r *http.Request) {
|
|||||||
_ = json.NewEncoder(w).Encode(resp)
|
_ = json.NewEncoder(w).Encode(resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Assign role to user
|
// @Summary Assign role to user
|
||||||
// @Tags acl/users
|
// @Tags acl/users
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param userId path int true "User ID" example(1)
|
// @Param userId path int true "User ID" example(1)
|
||||||
// @Param body body assignRoleToUserRequest true "Role ID"
|
// @Param body body assignRoleToUserRequest true "Role ID"
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 409 {object} ProblemDetails
|
// @Failure 409 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/users/{userId}/roles [post]
|
// @Router /api/acl/users/{userId}/roles [post]
|
||||||
func (h *aclAdminHandler) assignRoleToUser(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) assignRoleToUser(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
userIDStr := chi.URLParam(r, "userId")
|
userIDStr := chi.URLParam(r, "userId")
|
||||||
@@ -92,16 +92,16 @@ func (h *aclAdminHandler) assignRoleToUser(w http.ResponseWriter, r *http.Reques
|
|||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Remove role from user
|
// @Summary Remove role from user
|
||||||
// @Tags acl/users
|
// @Tags acl/users
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param userId path int true "User ID" example(1)
|
// @Param userId path int true "User ID" example(1)
|
||||||
// @Param roleId path int true "Role ID" example(1)
|
// @Param roleId path int true "Role ID" example(1)
|
||||||
// @Success 204
|
// @Success 204
|
||||||
// @Failure 400 {object} ProblemDetails
|
// @Failure 400 {object} ProblemDetails
|
||||||
// @Failure 404 {object} ProblemDetails
|
// @Failure 404 {object} ProblemDetails
|
||||||
// @Failure 500 {object} ProblemDetails
|
// @Failure 500 {object} ProblemDetails
|
||||||
// @Router /api/acl/users/{userId}/roles/{roleId} [delete]
|
// @Router /api/acl/users/{userId}/roles/{roleId} [delete]
|
||||||
func (h *aclAdminHandler) removeRoleFromUser(w http.ResponseWriter, r *http.Request) {
|
func (h *aclAdminHandler) removeRoleFromUser(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
userIDStr := chi.URLParam(r, "userId")
|
userIDStr := chi.URLParam(r, "userId")
|
||||||
|
|||||||
21
docs/docs.go
21
docs/docs.go
@@ -30,18 +30,15 @@ const docTemplate = `{
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "array",
|
"type": "object",
|
||||||
"items": {
|
"properties": {
|
||||||
"type": "object",
|
"id": {
|
||||||
"properties": {
|
"type": "integer",
|
||||||
"id": {
|
"example": 1
|
||||||
"type": "integer",
|
},
|
||||||
"example": 1
|
"key": {
|
||||||
},
|
"type": "string",
|
||||||
"key": {
|
"example": "html.view"
|
||||||
"type": "string",
|
|
||||||
"example": "html.view"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,15 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "array",
|
"type": "object",
|
||||||
"items": {
|
"properties": {
|
||||||
"type": "object",
|
"id": {
|
||||||
"properties": {
|
"type": "integer",
|
||||||
"id": {
|
"example": 1
|
||||||
"type": "integer",
|
},
|
||||||
"example": 1
|
"key": {
|
||||||
},
|
"type": "string",
|
||||||
"key": {
|
"example": "html.view"
|
||||||
"type": "string",
|
|
||||||
"example": "html.view"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,16 +149,14 @@ paths:
|
|||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
items:
|
items:
|
||||||
items:
|
properties:
|
||||||
properties:
|
id:
|
||||||
id:
|
example: 1
|
||||||
example: 1
|
type: integer
|
||||||
type: integer
|
key:
|
||||||
key:
|
example: html.view
|
||||||
example: html.view
|
type: string
|
||||||
type: string
|
type: object
|
||||||
type: object
|
|
||||||
type: array
|
|
||||||
type: array
|
type: array
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
|
|||||||
Reference in New Issue
Block a user