Skip to content

Commit

Permalink
(service) rebuild cache
Browse files Browse the repository at this point in the history
  • Loading branch information
uatuko committed Jul 9, 2023
1 parent c0782c6 commit 9dcb930
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/service/grpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ grpc::ServerUnaryReactor *Grpc::ConsumeEvent(

for (const auto &id : payload.ids()) {
const auto policy = datastore::RetrieveAccessPolicy(id);
for (const auto &identity : policy.identities()) {
for (const auto &identity : policy.identities(true)) {
for (const auto &rule : policy.rules()) {
const datastore::AccessPolicy::Cache cache({
.identity = identity,
Expand All @@ -287,7 +287,22 @@ grpc::ServerUnaryReactor *Grpc::ConsumeEvent(
}

for (const auto &id : payload.ids()) {
// TODO:
const auto policy = datastore::RetrieveRbacPolicy(id);
for (const auto &identity : policy.identities(true)) {
for (const auto &rule : policy.rules()) {
const auto role = datastore::RetrieveRole(rule.roleId);
for (const auto &perm : role.permissions()) {
const datastore::RbacPolicy::Cache cache({
.identity = identity,
.permission = perm,
.policy = policy.id(),
.rule = rule,
});

cache.store();
}
}
}
}
} else {
reactor->Finish(grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "Unknown event"));
Expand Down

0 comments on commit 9dcb930

Please sign in to comment.