MCPcopy Index your code
hub / github.com/belak/gitdir / EnsureAdminUser

Method EnsureAdminUser

ssh_server.go:52–78  ·  view source on GitHub ↗
(username string, pubKey *models.PublicKey)

Source from the content-addressed store, hash-verified

50}
51
52func (serv *Server) EnsureAdminUser(username string, pubKey *models.PublicKey) error {
53 serv.lock.Lock()
54 defer serv.lock.Unlock()
55
56 // Create a new config object
57 config := NewConfig(serv.fs)
58
59 // Ensure the sample config
60 err := config.EnsureConfig()
61 if err != nil {
62 return err
63 }
64
65 // Ensure the user exists
66 err = config.EnsureAdminUser(username, pubKey)
67 if err != nil {
68 return err
69 }
70
71 // Load the config from master
72 err = config.Load()
73 if err != nil {
74 return err
75 }
76
77 return serv.reloadUnlocked(config)
78}
79
80// Reload reloads the server config in a thread-safe way.
81func (serv *Server) Reload() error {

Callers 1

cmdServeFunction · 0.95

Calls 5

EnsureConfigMethod · 0.95
EnsureAdminUserMethod · 0.95
LoadMethod · 0.95
reloadUnlockedMethod · 0.95
NewConfigFunction · 0.85

Tested by

no test coverage detected