You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/11/22 02:27:26 UTC
[GitHub] [servicecomb-kie] 123yangxiong opened a new pull request, #268: 修复在RBAC在只有create权限时,create配置报错
123yangxiong opened a new pull request, #268:
URL: https://github.com/apache/servicecomb-kie/pull/268
修复在RBAC在只有create权限时,create配置报错
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-kie] 123yangxiong commented on a diff in pull request #268: 修复在RBAC在只有create权限时,create配置报错
Posted by GitBox <gi...@apache.org>.
123yangxiong commented on code in PR #268:
URL: https://github.com/apache/servicecomb-kie/pull/268#discussion_r1029159073
##########
server/datasource/etcd/kv/kv_dao.go:
##########
@@ -507,6 +507,50 @@ func (s *Dao) List(ctx context.Context, project, domain string, options ...datas
return pagingResult(result, opts), nil
}
+func (s *Dao) ListNoAuth(ctx context.Context, project, domain string, options ...datasource.FindOption) (*model.KVResponse, error) {
Review Comment:
已改为在opts中传入参数判断是否校验
##########
server/datasource/etcd/kv/kv_dao.go:
##########
@@ -507,6 +507,50 @@ func (s *Dao) List(ctx context.Context, project, domain string, options ...datas
return pagingResult(result, opts), nil
}
+func (s *Dao) ListNoAuth(ctx context.Context, project, domain string, options ...datasource.FindOption) (*model.KVResponse, error) {
+ opts := datasource.NewDefaultFindOpts()
+ for _, o := range options {
+ o(&opts)
+ }
+ ctx, cancel := context.WithTimeout(ctx, opts.Timeout)
+ defer cancel()
+
+ regex, err := toRegex(opts)
+ if err != nil {
+ return nil, err
+ }
+ // TODO may be OOM
+ kvs, _, err := etcdadpt.List(ctx, key.KVList(domain, project))
+ if err != nil {
+ openlog.Error("list kv failed: " + err.Error())
+ return nil, err
+ }
+ result := &model.KVResponse{
+ Data: []*model.KVDoc{},
+ }
+ for _, kv := range kvs {
Review Comment:
已改为在opts中传入参数判断是否校验
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-kie] little-cui commented on a diff in pull request #268: 修复在RBAC在只有create权限时,create配置报错
Posted by GitBox <gi...@apache.org>.
little-cui commented on code in PR #268:
URL: https://github.com/apache/servicecomb-kie/pull/268#discussion_r1029058281
##########
server/datasource/etcd/kv/kv_dao.go:
##########
@@ -507,6 +507,50 @@ func (s *Dao) List(ctx context.Context, project, domain string, options ...datas
return pagingResult(result, opts), nil
}
+func (s *Dao) ListNoAuth(ctx context.Context, project, domain string, options ...datasource.FindOption) (*model.KVResponse, error) {
+ opts := datasource.NewDefaultFindOpts()
+ for _, o := range options {
+ o(&opts)
+ }
+ ctx, cancel := context.WithTimeout(ctx, opts.Timeout)
+ defer cancel()
+
+ regex, err := toRegex(opts)
+ if err != nil {
+ return nil, err
+ }
+ // TODO may be OOM
+ kvs, _, err := etcdadpt.List(ctx, key.KVList(domain, project))
+ if err != nil {
+ openlog.Error("list kv failed: " + err.Error())
+ return nil, err
+ }
+ result := &model.KVResponse{
+ Data: []*model.KVDoc{},
+ }
+ for _, kv := range kvs {
Review Comment:
与List函数重复度高
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-kie] little-cui commented on a diff in pull request #268: 修复在RBAC在只有create权限时,create配置报错
Posted by GitBox <gi...@apache.org>.
little-cui commented on code in PR #268:
URL: https://github.com/apache/servicecomb-kie/pull/268#discussion_r1029247766
##########
server/datasource/options.go:
##########
@@ -156,3 +157,10 @@ func WithOffset(os int64) FindOption {
o.Offset = os
}
}
+
+// WithSkipAuth tells service skip authority
+func WithSkipAuth() FindOption {
Review Comment:
数据源增加auth概念,不合理
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-kie] little-cui commented on a diff in pull request #268: 修复在RBAC在只有create权限时,create配置报错
Posted by GitBox <gi...@apache.org>.
little-cui commented on code in PR #268:
URL: https://github.com/apache/servicecomb-kie/pull/268#discussion_r1029042366
##########
server/datasource/etcd/kv/kv_dao.go:
##########
@@ -507,6 +507,50 @@ func (s *Dao) List(ctx context.Context, project, domain string, options ...datas
return pagingResult(result, opts), nil
}
+func (s *Dao) ListNoAuth(ctx context.Context, project, domain string, options ...datasource.FindOption) (*model.KVResponse, error) {
Review Comment:
此特殊场景的接口应私有化
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-kie] little-cui merged pull request #268: 修复在RBAC在只有create权限时,create配置报错
Posted by GitBox <gi...@apache.org>.
little-cui merged PR #268:
URL: https://github.com/apache/servicecomb-kie/pull/268
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org