From 7e7e7ee32e353b366ee05e7ae63d8124a092d767 Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.b.seidl@stud.h-da.de> Date: Tue, 19 Apr 2022 16:55:24 +0200 Subject: [PATCH] linter pleasing --- cli/cmd/userGet.go | 1 - cli/cmd/userGetAll.go | 1 - controller/northbound/server/auth.go | 2 -- controller/northbound/server/auth_interceptor.go | 4 ---- 4 files changed, 8 deletions(-) diff --git a/cli/cmd/userGet.go b/cli/cmd/userGet.go index 9aaba3dd7..807988b87 100644 --- a/cli/cmd/userGet.go +++ b/cli/cmd/userGet.go @@ -72,5 +72,4 @@ func init() { // is called directly, e.g.: // loginCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") userGetCmd.Flags().StringVar(&nbUserName, "u", "", "username to find") - } diff --git a/cli/cmd/userGetAll.go b/cli/cmd/userGetAll.go index e2568ddfd..21c3867ee 100644 --- a/cli/cmd/userGetAll.go +++ b/cli/cmd/userGetAll.go @@ -73,5 +73,4 @@ func init() { // Cobra supports local flags which will only run when this command // is called directly, e.g.: // loginCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") - } diff --git a/controller/northbound/server/auth.go b/controller/northbound/server/auth.go index e9284484b..6d4610aac 100644 --- a/controller/northbound/server/auth.go +++ b/controller/northbound/server/auth.go @@ -200,7 +200,6 @@ func (s Auth) DeleteUsers(ctx context.Context, request *apb.DeleteUsersRequest) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) for _, u := range request.Username { - userToDelete, err := userc.Get(store.Query{Name: u}) if err != nil { return nil, status.Errorf(codes.Canceled, "user not found %v", err) @@ -229,7 +228,6 @@ func (s Auth) isValidUser(user rbac.User) (bool, error) { return true, nil } } - } return false, status.Errorf(codes.Unauthenticated, "incorrect user name or password") diff --git a/controller/northbound/server/auth_interceptor.go b/controller/northbound/server/auth_interceptor.go index eb8dc4508..cc127da9b 100644 --- a/controller/northbound/server/auth_interceptor.go +++ b/controller/northbound/server/auth_interceptor.go @@ -55,7 +55,6 @@ func (auth AuthInterceptor) Stream() grpc.StreamServerInterceptor { info *grpc.StreamServerInfo, handler grpc.StreamHandler, ) error { - err := auth.authorize(stream.Context(), info.FullMethod) if err != nil { return err @@ -85,7 +84,6 @@ func (auth AuthInterceptor) authorize(ctx context.Context, method string) error if err != nil { return err } - } else { return status.Errorf(codes.PermissionDenied, "no auth token provided") } @@ -94,7 +92,6 @@ func (auth AuthInterceptor) authorize(ctx context.Context, method string) error } func verifyPermisisonForRequestedCall(claims *rbac.UserClaims, requestedMethod string) error { - user, err := userc.Get(store.Query{Name: claims.Username}) if err != nil { return err @@ -119,7 +116,6 @@ func verifyPermisisonForRequestedCall(claims *rbac.UserClaims, requestedMethod s } } } - } return status.Errorf(codes.PermissionDenied, "user not authorized for this call") -- GitLab