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
parent
534c2791ca
commit
e2b21c0133
|
|
@ -112,7 +112,7 @@ func (c *CronJob) ScanSA(ctx context.Context, fqn string, wait bool) (Refs, erro
|
||||||
// ToggleSuspend toggles suspend/resume on a CronJob.
|
// ToggleSuspend toggles suspend/resume on a CronJob.
|
||||||
func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error {
|
func (c *CronJob) ToggleSuspend(ctx context.Context, path string) error {
|
||||||
ns, n := client.Namespaced(path)
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue