Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

NOISSUE - Fix Users Tests #42

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions auth/mocks/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ func (m *Service) Issue(ctx context.Context, in *magistrala.IssueReq, opts ...gr
if in.GetUserId() == InvalidValue || in.GetUserId() == "" {
return &magistrala.Token{}, errors.ErrAuthentication
}
if in.GetDomainId() == InvalidValue || in.GetDomainId() == "" {
return &magistrala.Token{}, errors.ErrAuthentication
}

return ret.Get(0).(*magistrala.Token), ret.Error(1)
}
Expand All @@ -37,9 +34,6 @@ func (m *Service) Refresh(ctx context.Context, in *magistrala.RefreshReq, opts .
if in.GetRefreshToken() == InvalidValue || in.GetRefreshToken() == "" {
return &magistrala.Token{}, errors.ErrAuthentication
}
if in.GetDomainId() == InvalidValue || in.GetDomainId() == "" {
return &magistrala.Token{}, errors.ErrAuthentication
}

return ret.Get(0).(*magistrala.Token), ret.Error(1)
}
Expand Down
10 changes: 5 additions & 5 deletions users/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (svc service) UpdateClientSecret(ctx context.Context, token, oldSecret, new
if err != nil {
return mgclients.Client{}, err
}
if _, err := svc.IssueToken(ctx, dbClient.Credentials.Identity, "", oldSecret); err != nil {
if _, err := svc.IssueToken(ctx, dbClient.Credentials.Identity, oldSecret, ""); err != nil {
return mgclients.Client{}, err
}
newSecret, err = svc.hasher.Hash(newSecret)
Expand Down Expand Up @@ -471,12 +471,12 @@ func (svc service) ListMembers(ctx context.Context, token, objectKind string, ob
}

func (svc *service) checkSuperAdmin(ctx context.Context, adminID string) error {
if err := svc.clients.CheckSuperAdmin(ctx, adminID); err != nil {
return err
}
if _, err := svc.authorize(ctx, auth.UserType, auth.UsersKind, adminID, auth.AdminPermission, auth.PlatformType, auth.MagistralaObject); err != nil {
return err
if err := svc.clients.CheckSuperAdmin(ctx, adminID); err != nil {
return err
}
}

return nil
}

Expand Down
Loading
Loading