Skip to content

Commit

Permalink
MG-2404 - Use Policy CRUD wrapper to directly talk to SpiceDB (absmac…
Browse files Browse the repository at this point in the history
…h#2405)

Signed-off-by: 1998-felix <[email protected]>
Signed-off-by: Dusan Borovcanin <[email protected]>
  • Loading branch information
felixgateru committed Oct 24, 2024
1 parent 8598e71 commit 7fff29f
Show file tree
Hide file tree
Showing 11 changed files with 1,387 additions and 536 deletions.
2 changes: 1 addition & 1 deletion bootstrap/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (bs bootstrapService) listClientIDs(ctx context.Context, userID string) ([]
if err != nil {
return nil, errors.Wrap(svcerr.ErrNotFound, err)
}
return tids, nil
return tids.Policies, nil
}

func (bs bootstrapService) List(ctx context.Context, session mgauthn.Session, filter Filter, offset, limit uint64) (ConfigsPage, error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/absmach/magistrala/auth/jwt"
apostgres "github.com/absmach/magistrala/auth/postgres"
"github.com/absmach/magistrala/auth/tracing"
mgpolicy "github.com/absmach/magistrala/internal/policy"
mglog "github.com/absmach/magistrala/logger"
"github.com/absmach/magistrala/pkg/jaeger"
"github.com/absmach/magistrala/pkg/policies/spicedb"
Expand Down
6 changes: 3 additions & 3 deletions internal/groups/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (svc service) ListMembers(ctx context.Context, session authn.Session, group

members := []groups.Member{}

for _, id := range tids {
for _, id := range tids.Policies {
members = append(members, groups.Member{
ID: id,
Type: policies.ThingType,
Expand All @@ -255,7 +255,7 @@ func (svc service) ListMembers(ctx context.Context, session authn.Session, group

members := []groups.Member{}

for _, id := range uids {
for _, id := range uids.Policies {
members = append(members, groups.Member{
ID: id,
Type: policies.UserType,
Expand Down Expand Up @@ -533,7 +533,7 @@ func (svc service) listAllGroupsOfUserID(ctx context.Context, userID, permission
if err != nil {
return []string{}, err
}
return allowedIDs, nil
return allowedIDs.Policies, nil
}

func (svc service) changeGroupStatus(ctx context.Context, session authn.Session, group groups.Group) (groups.Group, error) {
Expand Down
Loading

0 comments on commit 7fff29f

Please sign in to comment.