Skip to content

Commit

Permalink
fix: for code review
Browse files Browse the repository at this point in the history
  • Loading branch information
wy1433 committed Apr 12, 2024
1 parent a093419 commit d07d7db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
23 changes: 11 additions & 12 deletions include/session/user_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,50 @@
#include "common.h"
#include "parser.h"

using namespace parser;
namespace baikaldb {
DECLARE_bool(need_verify_ddl_permission);
DECLARE_bool(use_read_index);
inline uint32_t get_op_require_acl(pb::OpType op_type) {
switch (op_type) {
case pb::OP_SELECT:
case pb::OP_UNION:
return SELECT_ACL;
return parser::SELECT_ACL;
case pb::OP_INSERT:
return INSERT_ACL;
return parser::INSERT_ACL;
case pb::OP_DELETE:
case pb::OP_TRUNCATE_TABLE:
return DELETE_ACL;
return parser::DELETE_ACL;
case pb::OP_UPDATE:
return UPDATE_ACL;
return parser::UPDATE_ACL;
case pb::OP_LOAD:
return FILE_ACL;
return parser::FILE_ACL;
case pb::OP_CREATE_NAMESPACE:
case pb::OP_CREATE_DATABASE:
case pb::OP_CREATE_TABLE:
return CREATE_ACL;
return parser::CREATE_ACL;
case pb::OP_DROP_NAMESPACE:
case pb::OP_DROP_DATABASE:
case pb::OP_DROP_TABLE:
return DROP_ACL;
return parser::DROP_ACL;
case pb::OP_MODIFY_NAMESPACE:
case pb::OP_MODIFY_DATABASE:
case pb::OP_RENAME_TABLE:
case pb::OP_ADD_FIELD:
case pb::OP_DROP_FIELD:
case pb::OP_RENAME_FIELD:
case pb::OP_MODIFY_FIELD:
return ALTER_ACL;
return parser::ALTER_ACL;
case pb::OP_ADD_INDEX:
case pb::OP_DROP_INDEX:
case pb::OP_RENAME_INDEX:
return INDEX_ACL;
return parser::INDEX_ACL;
case pb::OP_CREATE_USER:
case pb::OP_DROP_USER:
case pb::OP_MODIFY_USER:
return CREATE_USER_ACL;
return parser::CREATE_USER_ACL;
case pb::OP_ADD_PRIVILEGE :
case pb::OP_DROP_PRIVILEGE:
return GRANT_ACL;
return parser::GRANT_ACL;
default:
return 0U;
}
Expand Down
1 change: 1 addition & 0 deletions src/common/schema_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,7 @@ int SchemaFactory::get_database_id(const std::string& db_name, int64_t& db_id) {
}

int SchemaFactory::get_show_database_id(const std::string& db_name, int64_t& db_id) {
BAIDU_SCOPED_LOCK(_update_show_db_mutex);
auto& db_name_id_mapping = _show_db_name_id_mapping;
if (db_name_id_mapping.count(try_to_lower(db_name)) == 0) {
return -1;
Expand Down

0 comments on commit d07d7db

Please sign in to comment.