MSP-7042 Add http_method to access_list
This commit is contained in:
1 parent
4932568c64
commit
e865549fdc
12 files changed
+251
-44
No files matched your search
@@ -16,6 +16,7 @@ type AccessListService interface {
|
||||
SetOne(ctx context.Context, request domain.AccessListSetOneRequest) (*domain.AccessListSetOneResponse, error)
|
||||
SetList(ctx context.Context, req domain.AccessListSetListRequest) ([]domain.MethodInfo, error)
|
||||
DeleteList(ctx context.Context, req domain.AccessListDeleteListRequest) error
|
||||
DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error
|
||||
}
|
||||
|
||||
type AccessList struct {
|
||||
@@ -141,3 +142,30 @@ func (c AccessList) DeleteList(ctx context.Context, req domain.AccessListDeleteL
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteListWithMethods godoc
|
||||
//
|
||||
// @Tags accessList
|
||||
// @Summary Удалить список доступных методов для приложения
|
||||
// @Description Удаляет заданный список методов для приложения
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.AccessListDeleteV2ListRequest false "тело запроса"
|
||||
// @Success 200 {object} any
|
||||
// @Failure 404 {object} apierrors.Error
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /access_list/delete_list_with_methods [POST]
|
||||
func (c AccessList) DeleteListWithMethods(ctx context.Context, req domain.AccessListDeleteV2ListRequest) error {
|
||||
err := c.service.DeleteListWithMethods(ctx, req)
|
||||
switch {
|
||||
case errors.Is(err, domain.ErrApplicationNotFound):
|
||||
return apierrors.New(
|
||||
codes.NotFound,
|
||||
domain.ErrCodeApplicationNotFound,
|
||||
fmt.Sprintf("application with id %d not found", req.AppId),
|
||||
err,
|
||||
)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
type SecureService interface {
|
||||
Authenticate(ctx context.Context, token string) (*domain.AuthData, error)
|
||||
Authorize(ctx context.Context, appId int, endpoint string) (bool, error)
|
||||
Authorize(ctx context.Context, req domain.AuthorizeRequest) (bool, error)
|
||||
}
|
||||
|
||||
type Secure struct {
|
||||
@@ -69,7 +69,7 @@ func (c Secure) Authenticate(ctx context.Context, req domain.AuthenticateRequest
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /secure/authorize [POST]
|
||||
func (c Secure) Authorize(ctx context.Context, req domain.AuthorizeRequest) (*domain.AuthorizeResponse, error) {
|
||||
result, err := c.service.Authorize(ctx, req.ApplicationId, req.Endpoint)
|
||||
result, err := c.service.Authorize(ctx, req)
|
||||
switch {
|
||||
case errors.Is(err, domain.ErrAccessListNotFound):
|
||||
return &domain.AuthorizeResponse{
|
||||
|
||||
Reference in new issue
Block a user