Skip to content

Commit 405f926

Browse files
committed
Split FillACL method
1 parent b1b70fa commit 405f926

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
6666
if (importInfo->UserSID) {
6767
record.SetOwner(*importInfo->UserSID);
6868
}
69+
FillOwner(record, item.Permissions);
6970

70-
if (!FillACL(record, item.Permissions, error)) {
71+
if (!FillACL(modifyScheme, item.Permissions, error)) {
7172
return nullptr;
7273
}
7374

ydb/core/ydb_convert/ydb_convert.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ void ProtoValueFromCell(NYdb::TValueBuilder& vb, const NScheme::TTypeInfo& typeI
14321432
}
14331433
}
14341434

1435-
bool FillACL(NKikimrScheme::TEvModifySchemeTransaction& out,
1435+
bool FillACL(NKikimrSchemeOp::TModifyScheme& out,
14361436
const TMaybeFail<Ydb::Scheme::ModifyPermissionsRequest>& in,
14371437
TString& error) {
14381438
if (in.Empty()) {
@@ -1443,15 +1443,24 @@ bool FillACL(NKikimrScheme::TEvModifySchemeTransaction& out,
14431443
for (const auto& action : in->actions()) {
14441444
if (action.has_grant() && !FillAllowPermissions(diffACL, action.grant(), error)) {
14451445
return false;
1446-
} else if (action.has_change_owner()) {
1447-
out.SetOwner(action.change_owner());
14481446
}
14491447
}
1448+
out.MutableModifyACL()->SetDiffACL(diffACL.SerializeAsString());
14501449

1451-
for (auto& tx : *out.MutableTransaction()) {
1452-
tx.MutableModifyACL()->SetDiffACL(diffACL.SerializeAsString());
1453-
}
14541450
return true;
14551451
}
14561452

1453+
void FillOwner(NKikimrScheme::TEvModifySchemeTransaction& out,
1454+
const TMaybeFail<Ydb::Scheme::ModifyPermissionsRequest>& in) {
1455+
if (in.Empty()) {
1456+
return;
1457+
}
1458+
1459+
for (const auto& action : in->actions()) {
1460+
if (action.has_change_owner()) {
1461+
out.SetOwner(action.change_owner());
1462+
}
1463+
}
1464+
}
1465+
14571466
} // namespace NKikimr

ydb/core/ydb_convert/ydb_convert.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ bool CellFromProtoVal(NScheme::TTypeInfo type, i32 typmod, const Ydb::Value* vp,
5757

5858
void ProtoValueFromCell(NYdb::TValueBuilder& vb, const NScheme::TTypeInfo& typeInfo, const TCell& cell);
5959

60-
bool FillACL(NKikimrScheme::TEvModifySchemeTransaction& out,
60+
bool FillACL(NKikimrSchemeOp::TModifyScheme& out,
6161
const TMaybeFail<Ydb::Scheme::ModifyPermissionsRequest>& in,
6262
TString& error);
6363

64+
void FillOwner(NKikimrScheme::TEvModifySchemeTransaction& out,
65+
const TMaybeFail<Ydb::Scheme::ModifyPermissionsRequest>& in);
66+
6467
} // namespace NKikimr

ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_schemeshard_/flat_schemeshard.schema

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5833,6 +5833,11 @@
58335833
"ColumnId": 10,
58345834
"ColumnName": "Issue",
58355835
"ColumnType": "Utf8"
5836+
},
5837+
{
5838+
"ColumnId": 11,
5839+
"ColumnName": "Permissions",
5840+
"ColumnType": "String"
58365841
}
58375842
],
58385843
"ColumnsDropped": [],
@@ -5848,7 +5853,8 @@
58485853
7,
58495854
8,
58505855
9,
5851-
10
5856+
10,
5857+
11
58525858
],
58535859
"RoomID": 0,
58545860
"Codec": 0,

0 commit comments

Comments
 (0)