diff --git a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp index f9cd4148955a..f2c38d58d261 100644 --- a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp +++ b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp @@ -4066,6 +4066,32 @@ Y_UNIT_TEST_SUITE(KqpScheme) { auto result = session.ExecuteSchemeQuery(query).GetValueSync(); UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); } + { + // Drop user with ACL + auto session = db.CreateSession().GetValueSync().GetSession(); + + TString query = TStringBuilder() << R"( + --!syntax_v1 + CREATE USER user2 PASSWORD NULL; + )"; + auto result = session.ExecuteSchemeQuery(query).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); + + query = TStringBuilder() << R"( + --!syntax_v1 + GRANT ALL ON `/Root` TO user2; + )"; + result = session.ExecuteSchemeQuery(query).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); + + query = TStringBuilder() << R"( + --!syntax_v1 + DROP USER user2; + )"; + result = session.ExecuteSchemeQuery(query).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::PRECONDITION_FAILED); + UNIT_ASSERT_STRING_CONTAINS(result.GetIssues().ToString(), "Error: User user2 has an ACL record on /Root and can't be removed"); + } } Y_UNIT_TEST(AlterUser) { diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp index bf82e2e89114..db50c3a7f431 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp @@ -207,7 +207,7 @@ class TAlterLogin: public TSubOperationBase { if (acl.HasAccess(user)) { auto pathStr = TPath::Init(pathId, context.SS).PathString(); return {.Error = TStringBuilder() << - "User " << user << " has ACL record on " << pathStr << " and can't be removed"}; + "User " << user << " has an ACL record on " << pathStr << " and can't be removed"}; } } diff --git a/ydb/core/tx/schemeshard/ut_login/ut_login.cpp b/ydb/core/tx/schemeshard/ut_login/ut_login.cpp index e751d2ae865e..7c9656b62396 100644 --- a/ydb/core/tx/schemeshard/ut_login/ut_login.cpp +++ b/ydb/core/tx/schemeshard/ut_login/ut_login.cpp @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardLoginTest) { // Cerr << DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot/Dir1").DebugString() << Endl; CreateAlterLoginRemoveUser(runtime, ++txId, "/MyRoot", "user1", - TVector{{NKikimrScheme::StatusPreconditionFailed, "User user1 has ACL record on /MyRoot/Dir1 and can't be removed"}}); + TVector{{NKikimrScheme::StatusPreconditionFailed, "User user1 has an ACL record on /MyRoot/Dir1 and can't be removed"}}); // check user still exists and has their rights: {