fix bugs reported by sonarqube
Signed-off-by: Roland.Ma <rolandma@kubesphere.io>
This commit is contained in:
@@ -220,10 +220,6 @@ func (c *repoOperator) ModifyRepo(id string, request *ModifyRepoRequest) error {
|
|||||||
if userInfo != nil {
|
if userInfo != nil {
|
||||||
cred.Password, _ = userInfo.Password()
|
cred.Password, _ = userInfo.Password()
|
||||||
cred.Username = userInfo.Username()
|
cred.Username = userInfo.Username()
|
||||||
} else {
|
|
||||||
// trim the old credential
|
|
||||||
cred.Password, _ = userInfo.Password()
|
|
||||||
cred.Username = userInfo.Username()
|
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(*request.URL, "s3://") {
|
} else if strings.HasPrefix(*request.URL, "s3://") {
|
||||||
cfg := v1alpha1.S3Config{}
|
cfg := v1alpha1.S3Config{}
|
||||||
|
|||||||
@@ -73,9 +73,5 @@ func (g *fedIngressGetter) filter(object runtime.Object, filter query.Filter) bo
|
|||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
switch filter.Field {
|
|
||||||
default:
|
|
||||||
return v1alpha3.DefaultObjectMetaFilter(deployment.ObjectMeta, filter)
|
return v1alpha3.DefaultObjectMetaFilter(deployment.ObjectMeta, filter)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -78,9 +78,5 @@ func (g *ingressGetter) filter(object runtime.Object, filter query.Filter) bool
|
|||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
switch filter.Field {
|
|
||||||
default:
|
|
||||||
return v1alpha3.DefaultObjectMetaFilter(deployment.ObjectMeta, filter)
|
return v1alpha3.DefaultObjectMetaFilter(deployment.ObjectMeta, filter)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -242,17 +242,10 @@ func (t *tenantOperator) makeQueryOptions(user user.Info, q meteringv1alpha1.Que
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if decision != authorizer.DecisionAllow {
|
if decision != authorizer.DecisionAllow {
|
||||||
if q.WorkspaceName != "" {
|
|
||||||
// specified by WorkspaceName & NamespaceName and not allowed
|
// specified by WorkspaceName & NamespaceName and not allowed
|
||||||
if q.NamespaceName != "" {
|
if q.NamespaceName != "" {
|
||||||
return qo, errors.New(fmt.Sprintf(meteringv1alpha1.ErrScopeNotAllowed, nsScope))
|
return qo, errors.New(fmt.Sprintf(meteringv1alpha1.ErrScopeNotAllowed, nsScope))
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// specified by NamespaceName & NamespaceName and not allowed
|
|
||||||
if q.NamespaceName != "" {
|
|
||||||
return qo, errors.New(fmt.Sprintf(meteringv1alpha1.ErrScopeNotAllowed, nsScope))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if q.ResourceFilter == "" {
|
if q.ResourceFilter == "" {
|
||||||
return qo, errors.New(fmt.Sprintf(meteringv1alpha1.ErrScopeNotAllowed, nsScope))
|
return qo, errors.New(fmt.Sprintf(meteringv1alpha1.ErrScopeNotAllowed, nsScope))
|
||||||
|
|||||||
Reference in New Issue
Block a user