Skip to content

Commit

Permalink
Add grants.DeleteByUserID
Browse files Browse the repository at this point in the history
  • Loading branch information
Serjlee committed Jul 15, 2020
1 parent d5e5ced commit d55ac58
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions management/grant.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package management

import "net/url"

type Grant struct {

// The id of the grant.
Expand Down Expand Up @@ -38,3 +40,12 @@ func (m *GrantManager) List(opts ...ListOption) (g []*Grant, err error) {
func (m *GrantManager) Delete(id string, opts ...ListOption) error {
return m.delete(m.uri("grants", id) + m.q(opts))
}

// Delete revokes all grants associated with a user-id
// https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id
func (m *GrantManager) DeleteByUserID(userID string, opts ...ListOption) error {
opts = append(opts, func(urls url.Values) {
urls.Add("user_id", userID)
})
return m.delete(m.uri("grants") + m.q(opts))
}

0 comments on commit d55ac58

Please sign in to comment.