From 61ea24c50d4b5f2330f2bd22af5d20bef1a5ac73 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Thu, 4 Jul 2024 15:53:48 +0500 Subject: [PATCH] Change roles to dict in Welcome --- cmd/wampproto/main.go | 4 ++-- cmd/wampproto/main_test.go | 2 +- cmd/wampproto/messages.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/wampproto/main.go b/cmd/wampproto/main.go index 2f503ac..72194db 100644 --- a/cmd/wampproto/main.go +++ b/cmd/wampproto/main.go @@ -165,7 +165,7 @@ func parseCmd(args []string) (*cmd, error) { Welcome: &Welcome{ welcome: welcomeCommand, sessionID: welcomeCommand.Arg("session-id", "WAMP session ID.").Required().Int64(), - welcomeRoles: welcomeCommand.Flag("roles", "Client roles.").Strings(), + welcomeRoles: welcomeCommand.Flag("roles", "Client roles.").StringMap(), welcomeAuthid: welcomeCommand.Flag("authid", "Client authid.").String(), welcomeAuthRole: welcomeCommand.Flag("authrole", "Client authrole.").String(), welcomeAuthMethod: welcomeCommand.Flag("authmethod", "Client authmethod.").String(), @@ -498,7 +498,7 @@ func Run(args []string) (string, error) { case c.welcome.FullCommand(): var ( - roles = wampprotocli.StringsToTypedList(*c.welcomeRoles) + roles = wampprotocli.StringMapToTypedMap(*c.welcomeRoles) authextra = wampprotocli.StringMapToTypedMap(*c.welcomeAuthExtra) ) diff --git a/cmd/wampproto/main_test.go b/cmd/wampproto/main_test.go index 7bcaad9..e8c6c90 100644 --- a/cmd/wampproto/main_test.go +++ b/cmd/wampproto/main_test.go @@ -409,7 +409,7 @@ func TestHelloMessage(t *testing.T) { } func TestWelcomeMessage(t *testing.T) { - var command = "wampproto message welcome 1 --roles callee --roles caller --authid foo " + + var command = "wampproto message welcome 1 --roles callee=true --roles caller=true --authid foo " + "--authmethod anonymous --authextra ticket=test" testMessageCommand(t, command) diff --git a/cmd/wampproto/messages.go b/cmd/wampproto/messages.go index 921bd40..b5141b2 100644 --- a/cmd/wampproto/messages.go +++ b/cmd/wampproto/messages.go @@ -16,7 +16,7 @@ type Hello struct { type Welcome struct { welcome *kingpin.CmdClause sessionID *int64 - welcomeRoles *[]string + welcomeRoles *map[string]string welcomeAuthid *string welcomeAuthRole *string welcomeAuthMethod *string