Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
Signed-off-by: Babak K. Shandiz <[email protected]>
  • Loading branch information
babakks committed Oct 12, 2023
1 parent 29ac788 commit 92b3b71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/openfga/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,13 @@ func unsetMultipleResourceAccesses[T ofganames.ResourceTagger](ctx context.Conte
tupleObject := ofganames.ConvertTag(user.ResourceTag())
tupleTarget := ofganames.ConvertTag(resource)

lastToken := ""
lastContinuationToken := ""
existingRelations := map[Relation]interface{}{}
for {
timestampedTuples, token, err := user.client.cofgaClient.FindMatchingTuples(ctx, Tuple{
timestampedTuples, continuationToken, err := user.client.cofgaClient.FindMatchingTuples(ctx, Tuple{
Object: tupleObject,
Target: tupleTarget,
}, 0, lastToken)
}, 0, lastContinuationToken)

if err != nil {
return errors.E(err, "failed to retrieve existing relations")
Expand All @@ -361,10 +361,10 @@ func unsetMultipleResourceAccesses[T ofganames.ResourceTagger](ctx context.Conte
existingRelations[timestampedTuple.Tuple.Relation] = nil
}

if token == lastToken {
if continuationToken == lastContinuationToken {
break
}
lastToken = token
lastContinuationToken = continuationToken
}

tuplesToRemove := make([]Tuple, 0, len(relations))
Expand Down

0 comments on commit 92b3b71

Please sign in to comment.