Fix order of arguments for `CanI` function call (#1866)

When checking permissions to (un)suspend cronjobs, a user will always be
considered as unauthorized, because of the wrong arguments order when
calling the `CanI` function.

For `CanI` definition, see:
2f72441bac/internal/client/client.go (L138)
```
func (a *APIClient) CanI(ns, gvr string, verbs []string) (auth bool, err error)
```
mine
Samuel Demirdjian 2022-11-15 22:06:31 -08:00 committed by GitHub
parent 534c2791ca
commit e2b21c0133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@ func (c *CronJob) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, erro
// ToggleSuspend toggles suspend/resume on a CronJob.
func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error {
ns, n := client.Namespaced(path)
auth, err := c.Client().CanI(c.GVR(), ns, []string{client.GetVerb, client.UpdateVerb})
auth, err := c.Client().CanI(ns, c.GVR(), []string{client.GetVerb, client.UpdateVerb})
if err != nil {
return err
}