Skip to content

Commit

Permalink
fix pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoneDutto committed Aug 27, 2024
1 parent 743ff12 commit 305f6aa
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions internal/rebac_admin/identities.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,20 @@ func (s *identitiesService) GetIdentityEntitlements(ctx context.Context, identit
return nil, err
}
originalToken := filter.Token()
nextToken := nextEntitlmentToken.String()
return &resources.PaginatedResponse[resources.EntityEntitlement]{
resp := resources.PaginatedResponse[resources.EntityEntitlement]{
Meta: resources.ResponseMeta{
Size: len(tuples),
PageToken: &originalToken,
},
Next: resources.Next{
PageToken: &nextToken,
},
Data: utils.ToEntityEntitlements(tuples),
}, nil
}
if nextEntitlmentToken.String() != "" {
nextToken := nextEntitlmentToken.String()
resp.Next = resources.Next{
PageToken: &nextToken,
}
}
return &resp, nil
}

// PatchIdentityEntitlements performs addition or removal of an Entitlement to/from an Identity.
Expand All @@ -233,15 +236,15 @@ func (s *identitiesService) PatchIdentityEntitlements(ctx context.Context, ident
)
}
for _, entitlementPatch := range entitlementPatches {
tag, err := toTargetTag(entitlementPatch)
targetTag, err := toTargetTag(entitlementPatch)
if err != nil {
errList.AppendError(err)
continue
}
t := apiparams.RelationshipTuple{
Object: objUser.Tag().String(),
Relation: entitlementPatch.Entitlement.Entitlement,
TargetObject: tag.String(),
TargetObject: targetTag.String(),
}
if entitlementPatch.Op == resources.IdentityEntitlementsPatchItemOpAdd {
toAdd = append(toAdd, t)
Expand Down

0 comments on commit 305f6aa

Please sign in to comment.