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 10:37:25 UTC

[GitHub] [servicecomb-kie] 123yangxiong commented on a diff in pull request #268: 修复在RBAC在只有create权限时,create配置报错

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