From 91cff17b9f83db9c0f26e5f65d6a09e030c32ce8 Mon Sep 17 00:00:00 2001 From: Ishank Arora Date: Wed, 7 Jul 2021 19:31:35 +0200 Subject: [PATCH] Lint fix --- pkg/auth/manager/demo/demo.go | 2 +- pkg/auth/manager/json/json.go | 2 +- pkg/auth/manager/ldap/ldap.go | 2 +- pkg/auth/manager/oidc/oidc.go | 2 +- pkg/storage/utils/eosfs/eosfs.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/auth/manager/demo/demo.go b/pkg/auth/manager/demo/demo.go index b7c09ced225..a4d18f6964b 100644 --- a/pkg/auth/manager/demo/demo.go +++ b/pkg/auth/manager/demo/demo.go @@ -55,7 +55,7 @@ func (m *manager) Authenticate(ctx context.Context, clientID, clientSecret strin if c.Secret == clientSecret { var scopes map[string]*authpb.Scope var err error - if c.User.Id.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { + if c.User.Id != nil && c.User.Id.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { scopes, err = scope.AddLightweightAccountScope(authpb.Role_ROLE_OWNER, nil) if err != nil { return nil, nil, err diff --git a/pkg/auth/manager/json/json.go b/pkg/auth/manager/json/json.go index 7d5b0021a81..e12c907126d 100644 --- a/pkg/auth/manager/json/json.go +++ b/pkg/auth/manager/json/json.go @@ -110,7 +110,7 @@ func (m *manager) Authenticate(ctx context.Context, username string, secret stri if c.Secret == secret { var scopes map[string]*authpb.Scope var err error - if c.ID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { + if c.ID != nil && c.ID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { scopes, err = scope.AddLightweightAccountScope(authpb.Role_ROLE_OWNER, nil) if err != nil { return nil, nil, err diff --git a/pkg/auth/manager/ldap/ldap.go b/pkg/auth/manager/ldap/ldap.go index 4a8ea78238a..1727076d0f1 100644 --- a/pkg/auth/manager/ldap/ldap.go +++ b/pkg/auth/manager/ldap/ldap.go @@ -218,7 +218,7 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string) } var scopes map[string]*authpb.Scope - if userID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { + if userID != nil && userID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { scopes, err = scope.AddLightweightAccountScope(authpb.Role_ROLE_OWNER, nil) if err != nil { return nil, nil, err diff --git a/pkg/auth/manager/oidc/oidc.go b/pkg/auth/manager/oidc/oidc.go index f3bff7c1a55..dd717bec85e 100644 --- a/pkg/auth/manager/oidc/oidc.go +++ b/pkg/auth/manager/oidc/oidc.go @@ -173,7 +173,7 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string) } var scopes map[string]*authpb.Scope - if userID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { + if userID != nil && userID.Type == user.UserType_USER_TYPE_LIGHTWEIGHT { scopes, err = scope.AddLightweightAccountScope(authpb.Role_ROLE_OWNER, nil) if err != nil { return nil, nil, err diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 6d5dcb23e9c..85c025aac02 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -1647,7 +1647,7 @@ func (fs *eosfs) extractUIDAndGID(u *userpb.User) (eosclient.Authorization, erro if u.GidNumber == 0 { return eosclient.Authorization{}, errors.New("eosfs: gid missing for user") } - return eosclient.Authorization{Role: eosclient.Role{strconv.FormatInt(u.UidNumber, 10), strconv.FormatInt(u.GidNumber, 10)}}, nil + return eosclient.Authorization{Role: eosclient.Role{UID: strconv.FormatInt(u.UidNumber, 10), GID: strconv.FormatInt(u.GidNumber, 10)}}, nil } func (fs *eosfs) getUIDGateway(ctx context.Context, u *userpb.UserId) (eosclient.Authorization, error) {