MCPcopy Index your code
hub / github.com/google/seesaw / accessCheck

Method accessCheck

engine/ipc.go:52–67  ·  view source on GitHub ↗

accessCheck performs an access check based on the given context and vserver.

(ctx *ipc.Context, vserver string)

Source from the content-addressed store, hash-verified

50
51// accessCheck performs an access check based on the given context and vserver.
52func (s *SeesawEngine) accessCheck(ctx *ipc.Context, vserver string) (string, error) {
53 switch {
54 case ctx.IsTrusted():
55 return "trusted", nil
56 case ctx.User.IsAdmin():
57 return "administrator", nil
58 case ctx.User.IsOperator():
59 hasAccess, reason := s.engine.vserverAccess.hasAccess(vserver, ctx.User.Username)
60 if !hasAccess {
61 return "", fmt.Errorf("%v: user %q is not authorized to control %q", errAccess, ctx.User.Username, vserver)
62 }
63 return reason, nil
64 default:
65 return "", errAccess
66 }
67}
68
69func (s *SeesawEngine) trace(call string, ctx *ipc.Context) {
70 log.V(2).Infof("SeesawEngine.%s called by %v", call, ctx)

Callers 1

OverrideVserverMethod · 0.95

Calls 4

IsTrustedMethod · 0.80
IsAdminMethod · 0.80
IsOperatorMethod · 0.80
hasAccessMethod · 0.45

Tested by

no test coverage detected