Skip to content

Commit

Permalink
chore: synchronize workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed May 13, 2024
1 parent c36786a commit 0c2bcfc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions persistence/sql/persister_consent.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,33 @@ func (p *Persister) revokeConsentSession(whereStmt string, whereArgs ...interfac

var args []string
var ids []interface{}
nid := p.NetworkID(ctx)

for _, f := range fs {
args = append(args, "?")
ids = append(ids, f.ConsentChallengeID.String())
}

params := strings.Join(args, ", ")
if err := p.QueryWithNetwork(ctx).
Where(
fmt.Sprintf("request_id IN (%s)", params),
ids...,
).
Where("nid = ?", nid).
Where("request_id IN (?)", ids...).
Delete(&OAuth2RequestSQL{Table: sqlTableAccess}); errors.Is(err, fosite.ErrNotFound) {
// do nothing
} else if err != nil {
return err
}

if err := p.QueryWithNetwork(ctx).
Where(
fmt.Sprintf("request_id IN (%s)", params),
ids...,
).
Where("nid = ?", nid).
Where("request_id IN (?)", ids...).
Delete(&OAuth2RequestSQL{Table: sqlTableRefresh}); errors.Is(err, fosite.ErrNotFound) {
// do nothing
} else if err != nil {
return err
}

count, err := c.RawQuery(
fmt.Sprintf("DELETE FROM hydra_oauth2_flow WHERE nid = ? AND consent_challenge_id IN (%s)", params),
fmt.Sprintf("DELETE FROM hydra_oauth2_flow WHERE nid = ? AND consent_challenge_id IN (%s)", strings.Join(args, "?")),
append(
[]interface{}{p.NetworkID(ctx)},
ids...,
Expand Down

0 comments on commit 0c2bcfc

Please sign in to comment.