-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: describe the user * refactor - add syntax desc user xxx * bug - add permission check * style - permissionCheck * fix - user not exist * test - add tck session and cases * style - remove annotation * refact - table style * feat - compatible with pipe * fix - merge conflict * style - format * feat - tck query by common user * refact - remove duplicate interfaces * fix comment
- Loading branch information
1 parent
c6d1046
commit a14d7b4
Showing
20 changed files
with
301 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* Copyright (c) 2020 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
|
||
#include "graph/executor/admin/DescribeUserExecutor.h" | ||
|
||
#include <thrift/lib/cpp/util/EnumUtils.h> | ||
|
||
#include "graph/context/QueryContext.h" | ||
#include "graph/planner/plan/Admin.h" | ||
#include "interface/gen-cpp2/meta_types.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
folly::Future<Status> DescribeUserExecutor::execute() { | ||
SCOPED_TIMER(&execTime_); | ||
return describeUser(); | ||
} | ||
|
||
folly::Future<Status> DescribeUserExecutor::describeUser() { | ||
auto* duNode = asNode<DescribeUser>(node()); | ||
return qctx() | ||
->getMetaClient() | ||
->getUserRoles(*duNode->username()) | ||
.via(runner()) | ||
.thenValue([this](StatusOr<std::vector<meta::cpp2::RoleItem>>&& resp) { | ||
SCOPED_TIMER(&execTime_); | ||
if (!resp.ok()) { | ||
return std::move(resp).status(); | ||
} | ||
|
||
DataSet v({"role", "space"}); | ||
auto roleItemList = std::move(resp).value(); | ||
for (auto& item : roleItemList) { | ||
if (item.get_space_id() == 0) { | ||
v.emplace_back( | ||
nebula::Row({apache::thrift::util::enumNameSafe(item.get_role_type()), ""})); | ||
} else { | ||
auto spaceNameResult = qctx_->schemaMng()->toGraphSpaceName(item.get_space_id()); | ||
if (spaceNameResult.ok()) { | ||
v.emplace_back(nebula::Row({apache::thrift::util::enumNameSafe(item.get_role_type()), | ||
spaceNameResult.value()})); | ||
} else { | ||
LOG(ERROR) << " Space name of " << item.get_space_id() << " no found"; | ||
return Status::Error("Space not found"); | ||
} | ||
} | ||
} | ||
return finish( | ||
ResultBuilder().value(Value(std::move(v))).iter(Iterator::Kind::kSequential).build()); | ||
}); | ||
} | ||
|
||
} // namespace graph | ||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Copyright (c) 2020 vesoft inc. All rights reserved. | ||
* | ||
* This source code is licensed under Apache 2.0 License. | ||
*/ | ||
|
||
#ifndef GRAPH_EXECUTOR_ADMIN_DESCRIBEUSEREXECUTOR_H_ | ||
#define GRAPH_EXECUTOR_ADMIN_DESCRIBEUSEREXECUTOR_H_ | ||
|
||
#include "graph/executor/Executor.h" | ||
|
||
namespace nebula { | ||
namespace graph { | ||
|
||
class DescribeUserExecutor final : public Executor { | ||
public: | ||
DescribeUserExecutor(const PlanNode *node, QueryContext *qctx) | ||
: Executor("DescribeUsersExecutor", node, qctx) {} | ||
|
||
folly::Future<Status> execute() override; | ||
|
||
private: | ||
folly::Future<Status> describeUser(); | ||
}; | ||
|
||
} // namespace graph | ||
} // namespace nebula | ||
|
||
#endif // GRAPH_EXECUTOR_ADMIN_LISTUSERSEXECUTOR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.