mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
session_rpcserver: create readonly session
In this commit, we add the ability to create a read only session type.
This commit is contained in:
parent
9cc974037b
commit
725f726571
1 changed files with 8 additions and 4 deletions
|
|
@ -52,9 +52,12 @@ func (s *sessionRpcServer) AddSession(_ context.Context,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if typ != session.TypeUIPassword && typ != session.TypeMacaroonAdmin {
|
||||
if typ != session.TypeUIPassword && typ != session.TypeMacaroonAdmin &&
|
||||
typ != session.TypeMacaroonReadonly {
|
||||
|
||||
return nil, fmt.Errorf("invalid session type, only UI " +
|
||||
"password and macaroon admin types supported in LiT")
|
||||
"password, admin and readonly macaroon types " +
|
||||
"supported in LiT")
|
||||
}
|
||||
|
||||
sess, err := session.NewSession(
|
||||
|
|
@ -116,11 +119,12 @@ func (s *sessionRpcServer) resumeSession(sess *session.Session) error {
|
|||
case session.TypeUIPassword:
|
||||
authData = []byte("Authorization: Basic " + s.basicAuth)
|
||||
|
||||
case session.TypeMacaroonAdmin:
|
||||
case session.TypeMacaroonAdmin, session.TypeMacaroonReadonly:
|
||||
ctx := context.Background()
|
||||
readOnly := sess.Type == session.TypeMacaroonReadonly
|
||||
mac, err := s.superMacBaker(
|
||||
ctx, sess.MacaroonRootKey, &session.MacaroonRecipe{
|
||||
Permissions: getAllPermissions(false),
|
||||
Permissions: getAllPermissions(readOnly),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue