lncli: add new listpermissions command

This commit is contained in:
Oliver Gugger 2020-09-04 09:22:49 +02:00
parent 830ce163c6
commit 3ce7f72cd4
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 24 additions and 0 deletions

@ -282,3 +282,26 @@ func deleteMacaroonID(ctx *cli.Context) error {
printRespJSON(resp) printRespJSON(resp)
return nil return nil
} }
var listPermissionsCommand = cli.Command{
Name: "listpermissions",
Category: "Macaroons",
Usage: "Lists all RPC method URIs and the macaroon permissions they " +
"require to be invoked.",
Action: actionDecorator(listPermissions),
}
func listPermissions(ctx *cli.Context) error {
client, cleanUp := getClient(ctx)
defer cleanUp()
request := &lnrpc.ListPermissionsRequest{}
response, err := client.ListPermissions(context.Background(), request)
if err != nil {
return err
}
printRespJSON(response)
return nil
}

@ -303,6 +303,7 @@ func main() {
bakeMacaroonCommand, bakeMacaroonCommand,
listMacaroonIDsCommand, listMacaroonIDsCommand,
deleteMacaroonIDCommand, deleteMacaroonIDCommand,
listPermissionsCommand,
trackPaymentCommand, trackPaymentCommand,
versionCommand, versionCommand,
} }