diff --git a/api/swagger/docs.go b/api/swagger/docs.go index e9424fce..d2461874 100644 --- a/api/swagger/docs.go +++ b/api/swagger/docs.go @@ -6228,7 +6228,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse" } } } @@ -8011,7 +8011,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse" } } } @@ -10374,6 +10374,30 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse": { + "type": "object", + "properties": { + "permissions": { + "description": "Permissions *PermissionTemplateResponse ` + "`" + `json:\"permissions\"` + "`" + `", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse": { + "type": "object", + "properties": { + "permissions": { + "description": "Permissions *PermissionSetResponse ` + "`" + `json:\"permissions\"` + "`" + `", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.GetPolicyResponse": { "type": "object", "properties": { @@ -10748,7 +10772,11 @@ const docTemplate = `{ "type": "object", "properties": { "permissions": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse" + "description": "Permissions *MergedPermissionSetResponse ` + "`" + `json:\"permissions\"` + "`" + `", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" + } } } }, @@ -11052,7 +11080,7 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" } }, - "is_allowed": { + "isAllowed": { "type": "boolean" }, "key": { @@ -11060,29 +11088,6 @@ const docTemplate = `{ } } }, - "github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse": { - "type": "object", - "properties": { - "configuration": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "dashboard": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "notification": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "policy": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "project_management": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "stack": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse": { "type": "object", "properties": { @@ -11206,7 +11211,7 @@ const docTemplate = `{ "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.EndpointResponse" } }, - "is_allowed": { + "isAllowed": { "type": "boolean" }, "key": { @@ -11217,29 +11222,6 @@ const docTemplate = `{ } } }, - "github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse": { - "type": "object", - "properties": { - "configuration": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "dashboard": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "notification": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "policy": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "project_management": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "stack": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.PermittedOrganization": { "type": "object", "properties": { @@ -12517,6 +12499,26 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.TemplateResponse": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse" + } + }, + "isAllowed": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.Unit": { "type": "object", "properties": { @@ -12736,13 +12738,32 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest": { + "type": "object", + "required": [ + "ID", + "isAllowed" + ], + "properties": { + "ID": { + "type": "string" + }, + "isAllowed": { + "type": "boolean", + "enum": [ + true, + false + ] + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionsByRoleIdRequest": { "type": "object", "properties": { "permissions": { "type": "array", "items": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest" } } } diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 59752e0b..27c2281a 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -6222,7 +6222,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse" } } } @@ -8005,7 +8005,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse" } } } @@ -10368,6 +10368,30 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse": { + "type": "object", + "properties": { + "permissions": { + "description": "Permissions *PermissionTemplateResponse `json:\"permissions\"`", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse": { + "type": "object", + "properties": { + "permissions": { + "description": "Permissions *PermissionSetResponse `json:\"permissions\"`", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.GetPolicyResponse": { "type": "object", "properties": { @@ -10742,7 +10766,11 @@ "type": "object", "properties": { "permissions": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse" + "description": "Permissions *MergedPermissionSetResponse `json:\"permissions\"`", + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" + } } } }, @@ -11046,7 +11074,7 @@ "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" } }, - "is_allowed": { + "isAllowed": { "type": "boolean" }, "key": { @@ -11054,29 +11082,6 @@ } } }, - "github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse": { - "type": "object", - "properties": { - "configuration": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "dashboard": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "notification": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "policy": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "project_management": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - }, - "stack": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse": { "type": "object", "properties": { @@ -11200,7 +11205,7 @@ "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.EndpointResponse" } }, - "is_allowed": { + "isAllowed": { "type": "boolean" }, "key": { @@ -11211,29 +11216,6 @@ } } }, - "github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse": { - "type": "object", - "properties": { - "configuration": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "dashboard": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "notification": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "policy": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "project_management": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - }, - "stack": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.PermittedOrganization": { "type": "object", "properties": { @@ -12511,6 +12493,26 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.TemplateResponse": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse" + } + }, + "isAllowed": { + "type": "boolean" + }, + "key": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.Unit": { "type": "object", "properties": { @@ -12730,13 +12732,32 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest": { + "type": "object", + "required": [ + "ID", + "isAllowed" + ], + "properties": { + "ID": { + "type": "string" + }, + "isAllowed": { + "type": "boolean", + "enum": [ + true, + false + ] + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionsByRoleIdRequest": { "type": "object", "properties": { "permissions": { "type": "array", "items": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest" } } } diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 12574cdc..55a0706b 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -1549,6 +1549,22 @@ definitions: organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' type: object + github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse: + properties: + permissions: + description: Permissions *PermissionTemplateResponse `json:"permissions"` + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse' + type: array + type: object + github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse: + properties: + permissions: + description: Permissions *PermissionSetResponse `json:"permissions"` + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' + type: array + type: object github_com_openinfradev_tks-api_pkg_domain.GetPolicyResponse: properties: policy: @@ -1788,7 +1804,10 @@ definitions: github_com_openinfradev_tks-api_pkg_domain.GetUsersPermissionsResponse: properties: permissions: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse' + description: Permissions *MergedPermissionSetResponse `json:"permissions"` + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' + type: array type: object github_com_openinfradev_tks-api_pkg_domain.ImportClusterRequest: properties: @@ -1989,26 +2008,11 @@ definitions: items: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' type: array - is_allowed: + isAllowed: type: boolean key: type: string type: object - github_com_openinfradev_tks-api_pkg_domain.MergedPermissionSetResponse: - properties: - configuration: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - dashboard: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - notification: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - policy: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - project_management: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - stack: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.MergePermissionResponse' - type: object github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse: properties: admin: @@ -2090,28 +2094,13 @@ definitions: items: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.EndpointResponse' type: array - is_allowed: + isAllowed: type: boolean key: type: string name: type: string type: object - github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse: - properties: - configuration: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - dashboard: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - notification: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - policy: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - project_management: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - stack: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' - type: object github_com_openinfradev_tks-api_pkg_domain.PermittedOrganization: properties: organizationId: @@ -2964,6 +2953,19 @@ definitions: required: - metricQuery type: object + github_com_openinfradev_tks-api_pkg_domain.TemplateResponse: + properties: + children: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.TemplateResponse' + type: array + isAllowed: + type: boolean + key: + type: string + name: + type: string + type: object github_com_openinfradev_tks-api_pkg_domain.Unit: properties: data: @@ -3110,11 +3112,24 @@ definitions: - newPassword - originPassword type: object + github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest: + properties: + ID: + type: string + isAllowed: + enum: + - true + - false + type: boolean + required: + - ID + - isAllowed + type: object github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionsByRoleIdRequest: properties: permissions: items: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdatePermissionUpdateRequest' type: array type: object github_com_openinfradev_tks-api_pkg_domain.UpdatePolicyClustersRequest: @@ -7489,7 +7504,7 @@ paths: "200": description: OK schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionsByRoleIdResponse' security: - JWT: [] summary: Get Permissions By Role ID @@ -8649,7 +8664,7 @@ paths: "200": description: OK schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PermissionSetResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetPermissionTemplatesResponse' security: - JWT: [] summary: Get Permission Templates diff --git a/internal/delivery/http/permission.go b/internal/delivery/http/permission.go index 2dcaf3ce..3ad7798f 100644 --- a/internal/delivery/http/permission.go +++ b/internal/delivery/http/permission.go @@ -32,7 +32,7 @@ func NewPermissionHandler(usecase usecase.Usecase) IPermissionHandler { // @Description Get Permission Templates // @Accept json // @Produce json -// @Success 200 {object} domain.PermissionSetResponse +// @Success 200 {object} domain.GetPermissionTemplatesResponse // @Router /permissions/templates [get] // @Security JWT func (h PermissionHandler) GetPermissionTemplates(w http.ResponseWriter, r *http.Request) { diff --git a/internal/delivery/http/role.go b/internal/delivery/http/role.go index a04441a2..d9020890 100644 --- a/internal/delivery/http/role.go +++ b/internal/delivery/http/role.go @@ -285,7 +285,7 @@ func (h RoleHandler) UpdateTksRole(w http.ResponseWriter, r *http.Request) { // @Produce json // @Param organizationId path string true "Organization ID" // @Param roleId path string true "Role ID" -// @Success 200 {object} domain.PermissionSetResponse +// @Success 200 {object} domain.GetPermissionsByRoleIdResponse // @Router /organizations/{organizationId}/roles/{roleId}/permissions [get] // @Security JWT func (h RoleHandler) GetPermissionsByRoleId(w http.ResponseWriter, r *http.Request) {