mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
SMQ - 2435 - Merge invitations into domains service (#2676)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
This commit is contained in:
@@ -25,7 +25,6 @@ const (
|
||||
defChannelsURL string = defURL + ":9005"
|
||||
defGroupsURL string = defURL + ":9004"
|
||||
defCertsURL string = defURL + ":9019"
|
||||
defInvitationsURL string = defURL + ":9020"
|
||||
defHTTPURL string = defURL + ":8008"
|
||||
defJournalURL string = defURL + ":9021"
|
||||
defTLSVerification bool = false
|
||||
@@ -43,7 +42,6 @@ type remotes struct {
|
||||
GroupsURL string `toml:"groups_url"`
|
||||
HTTPAdapterURL string `toml:"http_adapter_url"`
|
||||
CertsURL string `toml:"certs_url"`
|
||||
InvitationsURL string `toml:"invitations_url"`
|
||||
JournalURL string `toml:"journal_url"`
|
||||
HostURL string `toml:"host_url"`
|
||||
TLSVerification bool `toml:"tls_verification"`
|
||||
@@ -114,7 +112,6 @@ func ParseConfig(sdkConf smqsdk.Config) (smqsdk.Config, error) {
|
||||
GroupsURL: defGroupsURL,
|
||||
HTTPAdapterURL: defHTTPURL,
|
||||
CertsURL: defCertsURL,
|
||||
InvitationsURL: defInvitationsURL,
|
||||
JournalURL: defJournalURL,
|
||||
HostURL: defURL,
|
||||
TLSVerification: defTLSVerification,
|
||||
@@ -199,10 +196,6 @@ func ParseConfig(sdkConf smqsdk.Config) (smqsdk.Config, error) {
|
||||
sdkConf.CertsURL = config.Remotes.CertsURL
|
||||
}
|
||||
|
||||
if sdkConf.InvitationsURL == "" && config.Remotes.InvitationsURL != "" {
|
||||
sdkConf.InvitationsURL = config.Remotes.InvitationsURL
|
||||
}
|
||||
|
||||
if sdkConf.JournalURL == "" && config.Remotes.JournalURL != "" {
|
||||
sdkConf.JournalURL = config.Remotes.JournalURL
|
||||
}
|
||||
|
||||
+5
-5
@@ -10,20 +10,20 @@ import (
|
||||
|
||||
var cmdInvitations = []cobra.Command{
|
||||
{
|
||||
Use: "send <user_id> <domain_id> <relation> <user_auth_token>",
|
||||
Use: "send <user_id> <domain_id> <role_id> <user_auth_token>",
|
||||
Short: "Send invitation",
|
||||
Long: "Send invitation to user\n" +
|
||||
"For example:\n" +
|
||||
"\tsupermq-cli invitations send 39f97daf-d6b6-40f4-b229-2697be8006ef 4ef09eff-d500-4d56-b04f-d23a512d6f2a administrator $USER_AUTH_TOKEN\n",
|
||||
"\tsupermq-cli invitations send 39f97daf-d6b6-40f4-b229-2697be8006ef 4ef09eff-d500-4d56-b04f-d23a512d6f2a ba4c904c-e6d4-4978-9417-1694aac6793e $USER_AUTH_TOKEN\n",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 4 {
|
||||
logUsageCmd(*cmd, cmd.Use)
|
||||
return
|
||||
}
|
||||
inv := smqsdk.Invitation{
|
||||
UserID: args[0],
|
||||
DomainID: args[1],
|
||||
Relation: args[2],
|
||||
InviteeUserID: args[0],
|
||||
DomainID: args[1],
|
||||
RoleID: args[2],
|
||||
}
|
||||
if err := sdk.SendInvitation(inv, args[3]); err != nil {
|
||||
logErrorCmd(*cmd, err)
|
||||
|
||||
@@ -21,9 +21,9 @@ import (
|
||||
)
|
||||
|
||||
var invitation = mgsdk.Invitation{
|
||||
InvitedBy: testsutil.GenerateUUID(&testing.T{}),
|
||||
UserID: user.ID,
|
||||
DomainID: domain.ID,
|
||||
InvitedBy: testsutil.GenerateUUID(&testing.T{}),
|
||||
InviteeUserID: user.ID,
|
||||
DomainID: domain.ID,
|
||||
}
|
||||
|
||||
func TestSendUserInvitationCmd(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user