Skip to content

Commit

Permalink
Do not add CreatedAt to describe result
Browse files Browse the repository at this point in the history
  • Loading branch information
molotkov-and committed Dec 28, 2024
1 parent b5434a5 commit f204cd7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
48 changes: 0 additions & 48 deletions ydb/core/tx/schemeshard/ut_login/ut_login.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,54 +872,6 @@ Y_UNIT_TEST_SUITE(TSchemeShardLoginTest) {
});
CheckUserIsLockedOutPermanently(runtime);
}

Y_UNIT_TEST(CheckTimeOfUserCreating) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;

{
auto describe = DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
CheckSecurityState(describe, {.PublicKeysSize = 0, .SidsSize = 0});
}


{
std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
CreateAlterLoginCreateUser(runtime, ++txId, "/MyRoot", "user1", "password1");
std::chrono::time_point<std::chrono::system_clock> finish = std::chrono::system_clock::now();
auto describeResult = DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
CheckSecurityState(describeResult, {.PublicKeysSize = 0, .SidsSize = 1});

NLogin::TLoginProvider tmpLoginProvider;
tmpLoginProvider.UpdateSecurityState(describeResult.GetPathDescription().GetDomainDescription().GetSecurityState());
const auto& sid = tmpLoginProvider.Sids["user1"];
UNIT_ASSERT(sid.CreatedAt >= start && sid.CreatedAt <= finish);
}

{
std::chrono::time_point<std::chrono::system_clock> start = std::chrono::system_clock::now();
CreateAlterLoginCreateUser(runtime, ++txId, "/MyRoot", "user2", "password2");
std::chrono::time_point<std::chrono::system_clock> finish = std::chrono::system_clock::now();
auto describeResult = DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
CheckSecurityState(describeResult, {.PublicKeysSize = 0, .SidsSize = 2});

NLogin::TLoginProvider tmpLoginProvider;
tmpLoginProvider.UpdateSecurityState(describeResult.GetPathDescription().GetDomainDescription().GetSecurityState());
const auto& sid = tmpLoginProvider.Sids["user2"];
UNIT_ASSERT(sid.CreatedAt >= start && sid.CreatedAt <= finish);
}

{
auto describeResult = DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
NLogin::TLoginProvider tmpLoginProvider;
tmpLoginProvider.UpdateSecurityState(describeResult.GetPathDescription().GetDomainDescription().GetSecurityState());
const auto& sid1 = tmpLoginProvider.Sids["user1"];
const auto& sid2 = tmpLoginProvider.Sids["user2"];

UNIT_ASSERT(sid1.CreatedAt < sid2.CreatedAt);
}
}
}

namespace NSchemeShardUT_Private {
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/login/login.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ NLoginProto::TSecurityState TLoginProvider::GetSecurityState() const {
for (const auto& subSid : sidInfo.Members) {
sid.AddMembers(subSid);
}
sid.SetCreatedAt(std::chrono::duration_cast<std::chrono::milliseconds>(sidInfo.CreatedAt.time_since_epoch()).count());
// do not set CreatedAt. It does not need in describe result
// no user hash here
}
}
Expand Down

0 comments on commit f204cd7

Please sign in to comment.