-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
395 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#include "auth_scan_base.h" | ||
#include "owners.h" | ||
|
||
#include <ydb/core/sys_view/common/events.h> | ||
#include <ydb/core/sys_view/common/schema.h> | ||
#include <ydb/core/sys_view/common/scan_actor_base_impl.h> | ||
#include <ydb/core/base/tablet_pipecache.h> | ||
#include <ydb/library/login/protos/login.pb.h> | ||
|
||
#include <ydb/library/actors/core/hfunc.h> | ||
|
||
namespace NKikimr::NSysView::NAuth { | ||
|
||
using namespace NSchemeShard; | ||
using namespace NActors; | ||
|
||
class TOwnersScan : public TAuthScanBase<TOwnersScan> { | ||
public: | ||
using TScanBase = TScanActorBase<TOwnersScan>; | ||
using TAuthBase = TAuthScanBase<TOwnersScan>; | ||
|
||
TOwnersScan(const NActors::TActorId& ownerId, ui32 scanId, const TTableId& tableId, | ||
const TTableRange& tableRange, const TArrayRef<NMiniKQL::TKqpComputeContextBase::TColumn>& columns) | ||
: TAuthBase(ownerId, scanId, tableId, tableRange, columns) | ||
{ | ||
} | ||
|
||
protected: | ||
void FillBatch(NKqp::TEvKqpCompute::TEvScanData& batch, const TNavigate::TEntry& entry) override { | ||
Y_ABORT_UNLESS(entry.Status == TNavigate::EStatus::Ok); | ||
|
||
TVector<TCell> cells(::Reserve(Columns.size())); | ||
|
||
// TODO: add rows according to request's sender user rights | ||
|
||
auto entryPath = CanonizePath(entry.Path); | ||
auto entryOwner = entry.Self->Info.GetOwner(); | ||
|
||
for (auto& column : Columns) { | ||
switch (column.Tag) { | ||
case Schema::AuthOwners::Path::ColumnId: | ||
cells.push_back(TCell(entryPath.data(), entryPath.size())); | ||
break; | ||
case Schema::AuthOwners::Sid::ColumnId: | ||
cells.push_back(TCell(entryOwner.data(), entryOwner.size())); | ||
break; | ||
default: | ||
cells.emplace_back(); | ||
} | ||
} | ||
|
||
TArrayRef<const TCell> ref(cells); | ||
batch.Rows.emplace_back(TOwnedCellVec::Make(ref)); | ||
cells.clear(); | ||
|
||
batch.Finished = false; | ||
} | ||
}; | ||
|
||
THolder<NActors::IActor> CreateOwnersScan(const NActors::TActorId& ownerId, ui32 scanId, const TTableId& tableId, | ||
const TTableRange& tableRange, const TArrayRef<NMiniKQL::TKqpComputeContextBase::TColumn>& columns) | ||
{ | ||
return MakeHolder<TOwnersScan>(ownerId, scanId, tableId, tableRange, columns); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <ydb/core/kqp/runtime/kqp_compute.h> | ||
|
||
#include <ydb/library/actors/core/actor.h> | ||
#include <ydb/library/actors/core/actorid.h> | ||
|
||
namespace NKikimr::NSysView::NAuth { | ||
|
||
THolder<NActors::IActor> CreateOwnersScan(const NActors::TActorId& ownerId, ui32 scanId, const TTableId& tableId, | ||
const TTableRange& tableRange, const TArrayRef<NMiniKQL::TKqpComputeContextBase::TColumn>& columns); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.