@@ -133,23 +133,23 @@ func addWebService(c *restful.Container) error {
|
||||
Reads(CreateUserRequest{}).
|
||||
Returns(http.StatusOK, ok, errors.Error{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.DELETE("/users/{name}").
|
||||
ws.Route(ws.DELETE("/users/{username}").
|
||||
To(iam.DeleteUser).
|
||||
Doc("Remove a specified user.").
|
||||
Param(ws.PathParameter("name", "username")).
|
||||
Param(ws.PathParameter("username", "username")).
|
||||
Returns(http.StatusOK, ok, errors.Error{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.PUT("/users/{name}").
|
||||
ws.Route(ws.PUT("/users/{username}").
|
||||
To(iam.UpdateUser).
|
||||
Doc("Updates information about the specified user.").
|
||||
Param(ws.PathParameter("name", "username")).
|
||||
Param(ws.PathParameter("username", "username")).
|
||||
Reads(UserUpdateRequest{}).
|
||||
Returns(http.StatusOK, ok, errors.Error{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/users/{name}/log").
|
||||
ws.Route(ws.GET("/users/{username}/log").
|
||||
To(iam.UserLoginLog).
|
||||
Doc("This method is used to retrieve the \"login logs\" for the specified user.").
|
||||
Param(ws.PathParameter("name", "username")).
|
||||
Param(ws.PathParameter("username", "username")).
|
||||
Returns(http.StatusOK, ok, LoginLog{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/users").
|
||||
@@ -296,7 +296,7 @@ func addWebService(c *restful.Container) error {
|
||||
To(iam.RemoveUser).
|
||||
Doc("Remove members from workspace.").
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("name", "username")).
|
||||
Param(ws.PathParameter("username", "username")).
|
||||
Returns(http.StatusOK, ok, errors.Error{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/members/{username}").
|
||||
|
||||
@@ -60,7 +60,7 @@ func addWebService(c *restful.Container) error {
|
||||
ok := "ok"
|
||||
|
||||
webservice.Route(webservice.GET("/namespaces/{namespace}/{resources}").
|
||||
To(resources.ListResources).
|
||||
To(resources.ListNamespacedResources).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Doc("Namespace level resource query").
|
||||
Param(webservice.PathParameter("namespace", "which namespace")).
|
||||
@@ -81,7 +81,7 @@ func addWebService(c *restful.Container) error {
|
||||
Returns(http.StatusOK, ok, models.PageableResponse{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Doc("Cluster level resource query").
|
||||
Param(webservice.PathParameter("resources", "cluster level resource type"))).
|
||||
Param(webservice.PathParameter("resources", "cluster level resource type")).
|
||||
Param(webservice.QueryParameter(params.ConditionsParam, "query conditions").
|
||||
Required(false).
|
||||
DataFormat("key=value,key~value").
|
||||
@@ -89,7 +89,7 @@ func addWebService(c *restful.Container) error {
|
||||
Param(webservice.QueryParameter(params.PagingParam, "page").
|
||||
Required(false).
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1"))
|
||||
DefaultValue("limit=10,page=1")))
|
||||
|
||||
tags = []string{"Applications"}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/apiserver/tenant"
|
||||
"kubesphere.io/kubesphere/pkg/models/devops"
|
||||
"kubesphere.io/kubesphere/pkg/params"
|
||||
esclient "kubesphere.io/kubesphere/pkg/simple/client/elasticsearch"
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/elasticsearch"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/errors"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
@@ -59,7 +59,8 @@ func addWebService(c *restful.Container) error {
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/workspaces/{workspace}").
|
||||
To(tenant.DescribeWorkspace).
|
||||
Doc("Get workspace detail").
|
||||
Doc("Describe workspace").
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Returns(http.StatusOK, ok, v1alpha1.Workspace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/rules").
|
||||
@@ -87,7 +88,7 @@ func addWebService(c *restful.Container) error {
|
||||
Returns(http.StatusOK, ok, []v1.Namespace{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/members/{username}/namespaces").
|
||||
To(tenant.ListNamespaces).
|
||||
To(tenant.ListNamespacesByUsername).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("username", "workspace member's username")).
|
||||
Doc("List the namespaces for the workspace member").
|
||||
@@ -120,7 +121,7 @@ func addWebService(c *restful.Container) error {
|
||||
Doc("List devops projects for the current user").
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||
ws.Route(ws.GET("/workspaces/{workspace}/members/{username}/devops").
|
||||
To(tenant.ListDevopsProjects).
|
||||
To(tenant.ListDevopsProjectsByUsername).
|
||||
Param(ws.PathParameter("workspace", "workspace name")).
|
||||
Param(ws.PathParameter("username", "workspace member's username")).
|
||||
Param(ws.QueryParameter(params.PagingParam, "page").
|
||||
|
||||
@@ -77,7 +77,7 @@ func CreateUser(req *restful.Request, resp *restful.Response) {
|
||||
}
|
||||
|
||||
func DeleteUser(req *restful.Request, resp *restful.Response) {
|
||||
username := req.PathParameter("name")
|
||||
username := req.PathParameter("username")
|
||||
|
||||
operator := req.HeaderParameter(constants.UserNameHeader)
|
||||
|
||||
@@ -98,7 +98,7 @@ func DeleteUser(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
func UpdateUser(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
usernameInPath := req.PathParameter("name")
|
||||
usernameInPath := req.PathParameter("username")
|
||||
usernameInHeader := req.HeaderParameter(constants.UserNameHeader)
|
||||
var user models.User
|
||||
|
||||
@@ -162,7 +162,7 @@ func isUserManager(username string) (bool, error) {
|
||||
}
|
||||
|
||||
func UserLoginLog(req *restful.Request, resp *restful.Response) {
|
||||
username := req.PathParameter("name")
|
||||
username := req.PathParameter("username")
|
||||
logs, err := iam.LoginLog(username)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -26,6 +26,10 @@ import (
|
||||
"kubesphere.io/kubesphere/pkg/params"
|
||||
)
|
||||
|
||||
func ListNamespacedResources(req *restful.Request, resp *restful.Response) {
|
||||
ListResources(req, resp)
|
||||
}
|
||||
|
||||
func ListResources(req *restful.Request, resp *restful.Response) {
|
||||
namespace := req.PathParameter("namespace")
|
||||
resourceName := req.PathParameter("resources")
|
||||
|
||||
@@ -101,6 +101,9 @@ func DescribeWorkspace(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
resp.WriteAsJson(result)
|
||||
}
|
||||
func ListNamespacesByUsername(req *restful.Request, resp *restful.Response) {
|
||||
ListNamespaces(req, resp)
|
||||
}
|
||||
|
||||
func ListNamespaces(req *restful.Request, resp *restful.Response) {
|
||||
workspace := req.PathParameter("workspace")
|
||||
@@ -208,6 +211,10 @@ func checkResourceQuotas(wokrspace *v1alpha1.Workspace) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ListDevopsProjectsByUsername(req *restful.Request, resp *restful.Response) {
|
||||
ListDevopsProjects(req, resp)
|
||||
}
|
||||
|
||||
func ListDevopsProjects(req *restful.Request, resp *restful.Response) {
|
||||
|
||||
workspace := req.PathParameter("workspace")
|
||||
|
||||
Reference in New Issue
Block a user