mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
multi: add MacaroonPath method to subserver manager
This commit is contained in:
parent
0ab5cb750b
commit
9eb01518e6
2 changed files with 30 additions and 34 deletions
|
|
@ -189,6 +189,27 @@ func (s *Manager) ValidateMacaroon(ctx context.Context,
|
|||
return false, nil
|
||||
}
|
||||
|
||||
// MacaroonPath checks if any of the manager's sub-servers owns the given uri
|
||||
// and if so, the appropriate macaroon path is returned for that sub-server.
|
||||
func (s *Manager) MacaroonPath(uri string) (bool, string) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
for _, ss := range s.servers {
|
||||
if !s.permsMgr.IsSubServerURI(ss.Name(), uri) {
|
||||
continue
|
||||
}
|
||||
|
||||
if ss.Remote() {
|
||||
return true, ss.RemoteConfig().MacaroonPath
|
||||
}
|
||||
|
||||
return true, ss.MacPath()
|
||||
}
|
||||
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// Stop stops all the manager's sub-servers
|
||||
func (s *Manager) Stop() error {
|
||||
var returnErr error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue