Skip to content

Commit

Permalink
fix CheckPermission
Browse files Browse the repository at this point in the history
  • Loading branch information
akiyatomohiro committed Nov 6, 2024
1 parent c7840c0 commit dbb111c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cerbos/client/permission_checker_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"context"

"github.com/reearth/reearthx/appx"
"github.com/reearth/reearthx/i18n"
"github.com/reearth/reearthx/rerror"
)
Expand All @@ -12,7 +13,7 @@ var (
)

type PermissionService interface {
CheckPermission(ctx context.Context, resource string, action string) (bool, error)
CheckPermission(ctx context.Context, authInfo *appx.AuthInfo, resource string, action string) (bool, error)
}

func checkPermissionClient(client any) (PermissionService, bool) {
Expand All @@ -27,11 +28,11 @@ func checkPermissionClient(client any) (PermissionService, bool) {
return adapter, true
}

func CheckPermission(ctx context.Context, client any, resource string, action string) (bool, error) {
func CheckPermission(ctx context.Context, authInfo *appx.AuthInfo, client any, resource string, action string) (bool, error) {
checkPermissionAdapter, ok := checkPermissionClient(client)
if !ok {
return false, errOperationDenied
}

return checkPermissionAdapter.CheckPermission(ctx, resource, action)
return checkPermissionAdapter.CheckPermission(ctx, authInfo, resource, action)
}

0 comments on commit dbb111c

Please sign in to comment.