ores.refdata.sandbox_member
Table of Contents
One row per account a sandbox is shared with by name. Members
see the sandbox when its visibility is members; the owner needs no row.
1. Flags
2. Columns
2.1. id
UUID uniquely identifying this membership.
Surrogate key for the sandbox member record.
2.2. sandbox_id
The sandbox shared.
ctx.generate_uuid()
2.3. account_id
The account it is shared with.
ctx.generate_uuid()
3. SQL
3.1. Flags
4. Foreign keys
4.1. sandbox_id
The seed opens a sandbox the way a user would: an anchor portfolio, an
owner holding open_sandbox there, then the sandbox, which the insert
trigger refuses without the right.
#include "ores.iam.api/generators/account_generator.hpp" #include "ores.iam.core/repository/account_repository.hpp" #include "ores.refdata.api/generators/currency_generator.hpp" #include "ores.refdata.api/generators/party_generator.hpp" #include "ores.refdata.api/generators/portfolio_generator.hpp" #include "ores.refdata.api/generators/portfolio_right_generator.hpp" #include "ores.refdata.api/generators/sandbox_generator.hpp" #include "ores.refdata.core/repository/currency_repository.hpp" #include "ores.refdata.core/repository/party_repository.hpp" #include "ores.refdata.core/repository/portfolio_repository.hpp" #include "ores.refdata.core/repository/portfolio_right_repository.hpp" #include "ores.refdata.core/repository/sandbox_repository.hpp"
{
namespace gen = ores::refdata::generators;
namespace repo = ores::refdata::repository;
auto party = gen::generate_synthetic_party(ctx);
party.change_reason_code = "system.test";
for (const auto& e : repo::party_repository().read_latest(party_ctx)) {
if (e.tenant_id == party.tenant_id) {
party.parent_party_id = e.id;
break;
}
}
repo::party_repository().write(party_ctx, party);
auto currency = gen::generate_synthetic_currency(ctx);
currency.iso_code = "X-0";
repo::currency_repository().write(party_ctx, {currency});
auto anchor = gen::generate_synthetic_portfolio(ctx);
anchor.party_id = party.id;
anchor.change_reason_code = "system.test";
repo::portfolio_repository().write(party_ctx, anchor);
auto owner = ores::iam::generators::generate_synthetic_account(ctx);
owner.account_type = "service";
owner.change_reason_code = "system.test";
ores::iam::repository::account_repository().write(party_ctx, owner);
auto right = gen::generate_synthetic_portfolio_right(ctx);
right.account_id = owner.id;
right.portfolio_id = anchor.id;
right.right_code = "open_sandbox";
right.change_reason_code = "system.test";
repo::portfolio_right_repository().write(party_ctx, right);
auto sandbox = gen::generate_synthetic_sandbox(ctx);
sandbox.anchor_portfolio_id = anchor.id;
sandbox.owner_account_id = owner.id;
sandbox.change_reason_code = "system.test";
repo::sandbox_repository().write(party_ctx, sandbox);
v.sandbox_id = sandbox.id;
}
4.2. account_id
The seed is a service account, which leaves the test tenant in bootstrap.
#include "ores.iam.api/generators/account_generator.hpp" #include "ores.iam.core/repository/account_repository.hpp"
{
auto member = ores::iam::generators::generate_synthetic_account(ctx);
member.account_type = "service";
member.change_reason_code = "system.test";
ores::iam::repository::account_repository().write(party_ctx, member);
v.account_id = member.id;
}
5. C++
5.1. Flags
5.2. Repository
5.3. Domain includes
#include <string> #include <boost/uuid/uuid.hpp>
5.4. Entity includes
#include <string>
5.5. Conventions
5.6. Table display
| column | header |
|---|---|
| sandbox_id | Sandbox |
| account_id | Account |
| modified_by | Modified By |
| version | Version |
5.7. Presentation
5.7.1. Detail fields
| field | label | widget | type | is_key | is_required | placeholder |
|---|---|---|---|---|---|---|
| account_id | Account | accountIdEdit | line_edit | false | true | Account id |
5.7.2. Columns
| enum_name | field | header | type | width |
|---|---|---|---|---|
| Version | version | Version | int | 80 |
| ModifiedBy | modified_by | Modified By | string | 120 |
| RecordedAt | recorded_at | Recorded At | timestamp | 150 |
6. See also
- ores.refdata — component group overview.
- ores.refdata.sandbox — the sandbox shared.