MCPcopy Create free account
hub / github.com/cloudbase/garm / IsAdmin

Function IsAdmin

auth/context.go:290–296  ·  view source on GitHub ↗

IsAdmin returns a boolean indicating whether or not the context belongs to a logged in user and if that context has the admin flag set

(ctx context.Context)

Source from the content-addressed store, hash-verified

288// or not the context belongs to a logged in user
289// and if that context has the admin flag set
290func IsAdmin(ctx context.Context) bool {
291 elem := ctx.Value(isAdminKey)
292 if elem == nil {
293 return false
294 }
295 return elem.(bool)
296}
297
298// SetUserID sets the userID in the context
299func SetUserID(ctx context.Context, userID string) context.Context {

Callers 15

CreateRepositoryMethod · 0.92
ListRepositoriesMethod · 0.92
GetRepositoryByIDMethod · 0.92
DeleteRepositoryMethod · 0.92
UpdateRepositoryMethod · 0.92
CreateRepoPoolMethod · 0.92
GetRepoPoolByIDMethod · 0.92
DeleteRepoPoolMethod · 0.92
ListRepoPoolsMethod · 0.92
ListPoolInstancesMethod · 0.92
UpdateRepoPoolMethod · 0.92
ListRepoInstancesMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected