From e2b21c0133676d11b277e93cb045ff3fbdb18ad1 Mon Sep 17 00:00:00 2001 From: Samuel Demirdjian Date: Tue, 15 Nov 2022 22:06:31 -0800 Subject: [PATCH] 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: https://github.com/derailed/k9s/blob/2f72441bac30337fc2211e5ce5d93d3e475c9657/internal/client/client.go#L138 ``` func (a *APIClient) CanI(ns, gvr string, verbs []string) (auth bool, err error) ``` --- internal/dao/cronjob.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/dao/cronjob.go b/internal/dao/cronjob.go index ace45c80..38ed4807 100644 --- a/internal/dao/cronjob.go +++ b/internal/dao/cronjob.go @@ -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 }