From c832c91c30adb2ae6a4450603c15fb5cc0b75a64 Mon Sep 17 00:00:00 2001 From: donggyu Date: Wed, 6 Mar 2024 16:46:31 +0900 Subject: [PATCH 1/2] bug fix: missing JWT function --- internal/delivery/http/permission.go | 6 ++++++ internal/delivery/http/role.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/internal/delivery/http/permission.go b/internal/delivery/http/permission.go index 0b473a32..0116ac9c 100644 --- a/internal/delivery/http/permission.go +++ b/internal/delivery/http/permission.go @@ -33,6 +33,8 @@ func NewPermissionHandler(usecase usecase.Usecase) *PermissionHandler { // @Produce json // @Success 200 {object} domain.PermissionSet // @Router /permissions/templates [get] +// @Security JWT + func (h PermissionHandler) GetPermissionTemplates(w http.ResponseWriter, r *http.Request) { permissionSet := domain.NewDefaultPermissionSet() @@ -55,6 +57,8 @@ func (h PermissionHandler) GetPermissionTemplates(w http.ResponseWriter, r *http // @Produce json // @Success 200 {object} domain.PermissionSet // @Router /roles/{roleId}/permissions [get] +// @Security JWT + func (h PermissionHandler) GetPermissionsByRoleId(w http.ResponseWriter, r *http.Request) { // path parameter var roleId string @@ -94,6 +98,8 @@ func (h PermissionHandler) GetPermissionsByRoleId(w http.ResponseWriter, r *http // @Param body body domain.UpdatePermissionsByRoleIdRequest true "Update Permissions By Role ID Request" // @Success 200 // @Router /roles/{roleId}/permissions [put] +// @Security JWT + func (h PermissionHandler) UpdatePermissionsByRoleId(w http.ResponseWriter, r *http.Request) { // path parameter log.Debug("UpdatePermissionsByRoleId Called") diff --git a/internal/delivery/http/role.go b/internal/delivery/http/role.go index 7408878d..1e72fd05 100644 --- a/internal/delivery/http/role.go +++ b/internal/delivery/http/role.go @@ -44,6 +44,7 @@ func NewRoleHandler(usecase usecase.Usecase) *RoleHandler { // @Param body body domain.CreateTksRoleRequest true "Create Tks Role Request" // @Success 200 {object} domain.CreateTksRoleResponse // @Router /organizations/{organizationId}/roles [post] +// @Security JWT func (h RoleHandler) CreateTksRole(w http.ResponseWriter, r *http.Request) { // path parameter @@ -101,6 +102,8 @@ func (h RoleHandler) CreateTksRole(w http.ResponseWriter, r *http.Request) { // @Param organizationId path string true "Organization ID" // @Success 200 {object} domain.ListTksRoleResponse // @Router /organizations/{organizationId}/roles [get] +// @Security JWT + func (h RoleHandler) ListTksRoles(w http.ResponseWriter, r *http.Request) { // path parameter var organizationId string @@ -155,6 +158,7 @@ func (h RoleHandler) ListTksRoles(w http.ResponseWriter, r *http.Request) { // @Param roleId path string true "Role ID" // @Success 200 {object} domain.GetTksRoleResponse // @Router /organizations/{organizationId}/roles/{roleId} [get] +// @Security JWT func (h RoleHandler) GetTksRole(w http.ResponseWriter, r *http.Request) { // path parameter @@ -196,6 +200,7 @@ func (h RoleHandler) GetTksRole(w http.ResponseWriter, r *http.Request) { // @Param roleId path string true "Role ID" // @Success 200 // @Router /organizations/{organizationId}/roles/{roleId} [delete] +// @Security JWT func (h RoleHandler) DeleteTksRole(w http.ResponseWriter, r *http.Request) { // path parameter @@ -229,6 +234,7 @@ func (h RoleHandler) DeleteTksRole(w http.ResponseWriter, r *http.Request) { // @Param body body domain.UpdateTksRoleRequest true "Update Tks Role Request" // @Success 200 // @Router /organizations/{organizationId}/roles/{roleId} [put] +// @Security JWT func (h RoleHandler) UpdateTksRole(w http.ResponseWriter, r *http.Request) { // path parameter From 4c49b83dd25f367223bf4b48025d23f3438514f4 Mon Sep 17 00:00:00 2001 From: donggyu Date: Wed, 6 Mar 2024 16:50:03 +0900 Subject: [PATCH 2/2] minor fix --- internal/delivery/http/permission.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/delivery/http/permission.go b/internal/delivery/http/permission.go index 0116ac9c..84a04875 100644 --- a/internal/delivery/http/permission.go +++ b/internal/delivery/http/permission.go @@ -56,7 +56,7 @@ func (h PermissionHandler) GetPermissionTemplates(w http.ResponseWriter, r *http // @Accept json // @Produce json // @Success 200 {object} domain.PermissionSet -// @Router /roles/{roleId}/permissions [get] +// @Router organizations/{organizationId}/roles/{roleId}/permissions [get] // @Security JWT func (h PermissionHandler) GetPermissionsByRoleId(w http.ResponseWriter, r *http.Request) { @@ -97,7 +97,7 @@ func (h PermissionHandler) GetPermissionsByRoleId(w http.ResponseWriter, r *http // @Param roleId path string true "Role ID" // @Param body body domain.UpdatePermissionsByRoleIdRequest true "Update Permissions By Role ID Request" // @Success 200 -// @Router /roles/{roleId}/permissions [put] +// @Router organizations/{organizationId}/roles/{roleId}/permissions [put] // @Security JWT func (h PermissionHandler) UpdatePermissionsByRoleId(w http.ResponseWriter, r *http.Request) {