fix(ssh): ui: respect anon-access setting for the ui

Ayman Bagabas created

Fixes: https://github.com/charmbracelet/soft-serve/issues/759

Change summary

pkg/ssh/session.go | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

Detailed changes

pkg/ssh/session.go 🔗

@@ -45,11 +45,12 @@ func SessionHandler(s ssh.Session) *tea.Program {
 	initialRepo := ""
 	if len(cmd) == 1 {
 		initialRepo = cmd[0]
-		auth := be.AccessLevelByPublicKey(ctx, initialRepo, s.PublicKey())
-		if auth < access.ReadOnlyAccess {
-			wish.Fatalln(s, proto.ErrUnauthorized)
-			return nil
-		}
+	}
+
+	auth := be.AccessLevelByPublicKey(ctx, initialRepo, s.PublicKey())
+	if auth < access.ReadOnlyAccess {
+		wish.Fatalln(s, proto.ErrUnauthorized)
+		return nil
 	}
 
 	opts := bm.MakeOptions(s)