MCPcopy Index your code
hub / github.com/rilldata/rill / CheckAuth

Function CheckAuth

cli/pkg/cmdutil/check.go:25–38  ·  view source on GitHub ↗

CheckAuth checks if the user is authenticated.

(ch *Helper)

Source from the content-addressed store, hash-verified

23
24// CheckAuth checks if the user is authenticated.
25func CheckAuth(ch *Helper) PreRunCheck {
26 return func(cmd *cobra.Command, args []string) error {
27 localFlag := cmd.Flags().Lookup("local")
28 if localFlag != nil && localFlag.Changed {
29 return nil
30 }
31
32 // This will just check if token is present in the config
33 if !ch.IsAuthenticated() {
34 return fmt.Errorf("not authenticated, please run 'rill login'")
35 }
36 return nil
37 }
38}
39
40// CheckOrganization checks if the user has an organization set.
41func CheckOrganization(ch *Helper) PreRunCheck {

Callers 15

UserCmdFunction · 0.92
WhitelistCmdFunction · 0.92
RefreshCmdFunction · 0.92
ProjectCmdFunction · 0.92
ServiceCmdFunction · 0.92
TokenCmdFunction · 0.92
ChatCmdFunction · 0.92
OrgCmdFunction · 0.92
TokenCmdFunction · 0.92
OrgCmdFunction · 0.92
EnvCmdFunction · 0.92
SubscriptionCmdFunction · 0.92

Calls 3

IsAuthenticatedMethod · 0.80
LookupMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected