diff --git a/src/Access/AccessRights.cpp b/src/Access/AccessRights.cpp index 6f94cfac286..26af20c8a85 100644 --- a/src/Access/AccessRights.cpp +++ b/src/Access/AccessRights.cpp @@ -49,8 +49,7 @@ namespace const AccessFlags create_temporary_table_flag = AccessType::CREATE_TEMPORARY_TABLE; const AccessFlags alter_table_flag = AccessType::ALTER_TABLE; const AccessFlags alter_view_flag = AccessType::ALTER_VIEW; - const AccessFlags truncate_table_flag = AccessType::TRUNCATE_TABLE; - const AccessFlags truncate_view_flag = AccessType::TRUNCATE_VIEW; + const AccessFlags truncate_flag = AccessType::TRUNCATE; const AccessFlags drop_table_flag = AccessType::DROP_TABLE; const AccessFlags drop_view_flag = AccessType::DROP_VIEW; }; @@ -426,9 +425,6 @@ private: if (access & helper.alter_table_flag) implicit_access |= helper.alter_view_flag; - - if (access & helper.truncate_table_flag) - implicit_access |= helper.truncate_view_flag; } final_access = access | implicit_access; diff --git a/src/Access/AccessType.h b/src/Access/AccessType.h index 1d073a4d5db..7c8d18d53f6 100644 --- a/src/Access/AccessType.h +++ b/src/Access/AccessType.h @@ -76,9 +76,7 @@ enum class AccessType M(DROP_DICTIONARY, "", DICTIONARY, DROP) /* allows to execute {DROP|DETACH} DICTIONARY */\ M(DROP, "", GROUP, ALL) /* allows to execute {DROP|DETACH} */\ \ - M(TRUNCATE_VIEW, "", VIEW, TRUNCATE) \ - M(TRUNCATE_TABLE, "", TABLE, TRUNCATE) \ - M(TRUNCATE, "", GROUP, ALL) \ + M(TRUNCATE, "TRUNCATE TABLE", TABLE, ALL) \ M(OPTIMIZE, "OPTIMIZE TABLE", TABLE, ALL) \ \ M(KILL_QUERY, "", GLOBAL, ALL) /* allows to kill a query started by another user (anyone can kill his own queries) */\ diff --git a/src/Interpreters/InterpreterDropQuery.cpp b/src/Interpreters/InterpreterDropQuery.cpp index 42d9528abd5..e3f5d467f38 100644 --- a/src/Interpreters/InterpreterDropQuery.cpp +++ b/src/Interpreters/InterpreterDropQuery.cpp @@ -99,7 +99,7 @@ BlockIO InterpreterDropQuery::executeToTable( } else if (kind == ASTDropQuery::Kind::Truncate) { - context.checkAccess(table->isView() ? AccessType::TRUNCATE_VIEW : AccessType::TRUNCATE_TABLE, table_id); + context.checkAccess(AccessType::TRUNCATE, table_id); table->checkTableCanBeDropped(); /// If table was already dropped by anyone, an exception will be thrown @@ -316,7 +316,7 @@ AccessRightsElements InterpreterDropQuery::getRequiredAccessForDDLOnCluster() co if (drop.kind == ASTDropQuery::Kind::Drop) required_access.emplace_back(AccessType::DROP_TABLE | AccessType::DROP_VIEW, drop.database, drop.table); else if (drop.kind == ASTDropQuery::Kind::Truncate) - required_access.emplace_back(AccessType::TRUNCATE_TABLE | AccessType::TRUNCATE_VIEW, drop.database, drop.table); + required_access.emplace_back(AccessType::TRUNCATE, drop.database, drop.table); else if (drop.kind == ASTDropQuery::Kind::Detach) required_access.emplace_back(AccessType::DROP_TABLE | AccessType::DROP_VIEW, drop.database, drop.table); }