From ba556e1e0de73825e11f6d203a604c3e14d32ab6 Mon Sep 17 00:00:00 2001 From: Felix Gateru Date: Tue, 26 Nov 2024 11:39:52 +0300 Subject: [PATCH] NOISSUE - Fix return role on user creation (#2551) Signed-off-by: Felix Gateru --- cmd/certs/main.go | 2 +- cmd/journal/main.go | 4 ++-- cmd/postgres-reader/main.go | 4 ++-- cmd/things/main.go | 2 +- cmd/timescale-reader/main.go | 6 +++--- cmd/users/main.go | 4 ++-- internal/groups/middleware/logging.go | 4 ++-- users/postgres/users.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/certs/main.go b/cmd/certs/main.go index 00c7ac324..1b75d80d6 100644 --- a/cmd/certs/main.go +++ b/cmd/certs/main.go @@ -110,7 +110,7 @@ func main() { return } defer authnClient.Close() - logger.Info("AutN successfully connected to auth gRPC server " + authnClient.Secure()) + logger.Info("AuthN successfully connected to auth gRPC server " + authnClient.Secure()) tp, err := jaegerclient.NewProvider(ctx, svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio) if err != nil { diff --git a/cmd/journal/main.go b/cmd/journal/main.go index db95b19a3..8d7b6b349 100644 --- a/cmd/journal/main.go +++ b/cmd/journal/main.go @@ -109,7 +109,7 @@ func main() { return } defer authnHandler.Close() - logger.Info("Authn successfully connected to auth gRPC server " + authnHandler.Secure()) + logger.Info("AuthN successfully connected to auth gRPC server " + authnHandler.Secure()) authz, authzHandler, err := authsvcAuthz.NewAuthorization(ctx, authClientCfg) if err != nil { @@ -118,7 +118,7 @@ func main() { return } defer authzHandler.Close() - logger.Info("Authz successfully connected to auth gRPC server " + authzHandler.Secure()) + logger.Info("AuthZ successfully connected to auth gRPC server " + authzHandler.Secure()) tp, err := jaegerclient.NewProvider(ctx, svcName, cfg.JaegerURL, cfg.InstanceID, cfg.TraceRatio) if err != nil { diff --git a/cmd/postgres-reader/main.go b/cmd/postgres-reader/main.go index 5354061ba..0bbb62554 100644 --- a/cmd/postgres-reader/main.go +++ b/cmd/postgres-reader/main.go @@ -99,7 +99,7 @@ func main() { return } defer authzHandler.Close() - logger.Info("Authz successfully connected to auth gRPC server " + authzHandler.Secure()) + logger.Info("AuthZ successfully connected to auth gRPC server " + authzHandler.Secure()) authn, authnHandler, err := authsvcAuthn.NewAuthentication(ctx, clientCfg) if err != nil { @@ -108,7 +108,7 @@ func main() { return } defer authnHandler.Close() - logger.Info("Authn successfully connected to auth gRPC server " + authnHandler.Secure()) + logger.Info("AuthN successfully connected to auth gRPC server " + authnHandler.Secure()) thingsClientCfg := grpcclient.Config{} if err := env.ParseWithOptions(&thingsClientCfg, env.Options{Prefix: envPrefixThings}); err != nil { diff --git a/cmd/things/main.go b/cmd/things/main.go index f29f05c47..6410e6abc 100644 --- a/cmd/things/main.go +++ b/cmd/things/main.go @@ -160,7 +160,7 @@ func main() { exitCode = 1 return } - logger.Info("Policy Evaluator and Policy manager are successfully connected to SpiceDB gRPC server") + logger.Info("Policy evaluator and Policy manager are successfully connected to SpiceDB gRPC server") grpcCfg := grpcclient.Config{} if err := env.ParseWithOptions(&grpcCfg, env.Options{Prefix: envPrefixAuth}); err != nil { diff --git a/cmd/timescale-reader/main.go b/cmd/timescale-reader/main.go index 2d7a5e05c..066291a7f 100644 --- a/cmd/timescale-reader/main.go +++ b/cmd/timescale-reader/main.go @@ -99,7 +99,7 @@ func main() { return } defer authzHandler.Close() - logger.Info("Authz successfully connected to auth gRPC server " + authzHandler.Secure()) + logger.Info("AuthZ successfully connected to auth gRPC server " + authzHandler.Secure()) authn, authnHandler, err := authsvcAuthn.NewAuthentication(ctx, clientCfg) if err != nil { @@ -108,7 +108,7 @@ func main() { return } defer authnHandler.Close() - logger.Info("Authn successfully connected to auth gRPC server " + authnHandler.Secure()) + logger.Info("AuthN successfully connected to auth gRPC server " + authnHandler.Secure()) thingsClientCfg := grpcclient.Config{} if err := env.ParseWithOptions(&thingsClientCfg, env.Options{Prefix: envPrefixThings}); err != nil { @@ -125,7 +125,7 @@ func main() { } defer thingsHandler.Close() - logger.Info("ThingsService gRPC client successfully connected to things gRPC server " + thingsHandler.Secure()) + logger.Info("Things service gRPC client successfully connected to things gRPC server " + thingsHandler.Secure()) httpServerConfig := server.Config{Port: defSvcHTTPPort} if err := env.ParseWithOptions(&httpServerConfig, env.Options{Prefix: envPrefixHTTP}); err != nil { diff --git a/cmd/users/main.go b/cmd/users/main.go index a7e432127..3d285b9af 100644 --- a/cmd/users/main.go +++ b/cmd/users/main.go @@ -185,7 +185,7 @@ func main() { return } defer authnHandler.Close() - logger.Info("Authn successfully connected to auth gRPC server " + authnHandler.Secure()) + logger.Info("AuthN successfully connected to auth gRPC server " + authnHandler.Secure()) authz, authzHandler, err := authsvcAuthz.NewAuthorization(ctx, clientConfig) if err != nil { @@ -194,7 +194,7 @@ func main() { return } defer authzHandler.Close() - logger.Info("Authz successfully connected to auth gRPC server " + authzHandler.Secure()) + logger.Info("AuthZ successfully connected to auth gRPC server " + authzHandler.Secure()) domainsClient, domainsHandler, err := grpcclient.SetupDomainsClient(ctx, clientConfig) if err != nil { diff --git a/internal/groups/middleware/logging.go b/internal/groups/middleware/logging.go index 220f924d0..f1840efd1 100644 --- a/internal/groups/middleware/logging.go +++ b/internal/groups/middleware/logging.go @@ -225,10 +225,10 @@ func (lm *loggingMiddleware) Unassign(ctx context.Context, session authn.Session } if err != nil { args = append(args, slog.Any("error", err)) - lm.logger.Warn("Unassign member to group failed", args...) + lm.logger.Warn("Unassign member from group failed", args...) return } - lm.logger.Info("Unassign member to group completed successfully", args...) + lm.logger.Info("Unassign member from group completed successfully", args...) }(time.Now()) return lm.svc.Unassign(ctx, session, groupID, relation, memberKind, memberIDs...) diff --git a/users/postgres/users.go b/users/postgres/users.go index 37b23a43a..f2daae364 100644 --- a/users/postgres/users.go +++ b/users/postgres/users.go @@ -33,7 +33,7 @@ func NewRepository(db postgres.Database) users.Repository { func (repo *userRepo) Save(ctx context.Context, c users.User) (users.User, error) { q := `INSERT INTO users (id, tags, email, secret, metadata, created_at, status, role, first_name, last_name, username, profile_picture) VALUES (:id, :tags, :email, :secret, :metadata, :created_at, :status, :role, :first_name, :last_name, :username, :profile_picture) - RETURNING id, tags, email, metadata, created_at, status, first_name, last_name, username, profile_picture` + RETURNING id, tags, email, metadata, created_at, status, role, first_name, last_name, username, profile_picture` dbu, err := toDBUser(c) if err != nil {