Skip to content
Snippets Groups Projects
Commit 462e2904 authored by Alena Petraki's avatar Alena Petraki
Browse files

sip

parent 0707674c
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ import ( ...@@ -12,7 +12,6 @@ import (
"git.perx.ru/perxis/perxis-go/pkg/permission" "git.perx.ru/perxis/perxis-go/pkg/permission"
"git.perx.ru/perxis/perxis-go/pkg/roles" "git.perx.ru/perxis/perxis-go/pkg/roles"
"git.perx.ru/perxis/perxis-go/pkg/spaces" "git.perx.ru/perxis/perxis-go/pkg/spaces"
"git.perx.ru/perxis/perxis/services"
) )
type ClientPrincipal struct { type ClientPrincipal struct {
...@@ -212,7 +211,7 @@ func (c *ClientPrincipal) Rules(ctx context.Context, spaceID, envID string) perm ...@@ -212,7 +211,7 @@ func (c *ClientPrincipal) Rules(ctx context.Context, spaceID, envID string) perm
func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string) error { func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string) error {
if !c.IsValid(ctx) { if !c.IsValid(ctx) {
return services.ErrAccessDenied return ErrAccessDenied
} }
if c.IsSystem(ctx) { if c.IsSystem(ctx) {
...@@ -221,7 +220,7 @@ func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string) ...@@ -221,7 +220,7 @@ func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string)
if spaceID != "" { if spaceID != "" {
if c.spaceID == "" { if c.spaceID == "" {
return services.ErrAccessDenied return ErrAccessDenied
} }
client, _ := c.Client(ctx) client, _ := c.Client(ctx)
...@@ -234,7 +233,7 @@ func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string) ...@@ -234,7 +233,7 @@ func (c *ClientPrincipal) HasAccess(ctx context.Context, spaceID, orgID string)
return nil return nil
} }
return services.ErrAccessDenied return ErrAccessDenied
} }
func (c *ClientPrincipal) hasRole(ctx context.Context, spaceID string) (bool, error) { func (c *ClientPrincipal) hasRole(ctx context.Context, spaceID string) (bool, error) {
...@@ -243,9 +242,9 @@ func (c *ClientPrincipal) hasRole(ctx context.Context, spaceID string) (bool, er ...@@ -243,9 +242,9 @@ func (c *ClientPrincipal) hasRole(ctx context.Context, spaceID string) (bool, er
} }
client, err := c.Client(ctx) client, err := c.Client(ctx)
if err != nil && errors.Is(err, services.ErrNotFound) { if err != nil && errors.Is(err, ErrNotFound) {
if sp := c.getSpace(ctx, spaceID); sp == nil { if sp := c.getSpace(ctx, spaceID); sp == nil {
return false, services.ErrNotFound return false, ErrNotFound
} }
} }
if client != nil && client.SpaceID == spaceID { if client != nil && client.SpaceID == spaceID {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment