Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Ranger): Use Apache Ranger for ACL when replica master-slave learn #1445

Merged
merged 2 commits into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/replica/replica_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
#include "replica_disk_migrator.h"
#include "replica_stub.h"
#include "runtime/api_layer1.h"
#include "runtime/ranger/access_type.h"
#include "runtime/rpc/rpc_message.h"
#include "runtime/rpc/serialization.h"
#include "runtime/security/access_controller.h"
Expand Down Expand Up @@ -1310,14 +1311,19 @@ void replica_stub::on_group_check(group_check_rpc rpc)

void replica_stub::on_learn(dsn::message_ex *msg)
{
learn_response response;
learn_request request;
::dsn::unmarshall(msg, request);

replica_ptr rep = get_replica(request.pid);
if (rep != nullptr) {
if (!rep->access_controller_allowed(msg, ranger::access_type::kWrite)) {
response.err = ERR_ACL_DENY;
reply(msg, response);
return;
}
rep->on_learn(msg, request);
} else {
learn_response response;
response.err = ERR_OBJECT_NOT_FOUND;
reply(msg, response);
}
Expand Down