WHBANG commented on code in PR #1378:
URL: 
https://github.com/apache/incubator-pegasus/pull/1378#discussion_r1130949093


##########
src/runtime/ranger/ranger_resource_policy_manager.cpp:
##########
@@ -97,5 +134,30 @@ 
ranger_resource_policy_manager::ranger_resource_policy_manager(
                               "RPC_CM_RENAME_APP"},
                              _ac_type_of_database_rpcs);
 }
+
+void ranger_resource_policy_manager::parse_policies_from_json(const 
rapidjson::Value &data,
+                                                              
std::vector<policy_item> &policies)
+{
+    CHECK(policies.empty(), "Ranger policy list should not be empty.");
+    RETURN_VOID_IF_NOT_ARRAY(data);
+    for (const auto &item : data.GetArray()) {
+        CONTINUE_IF_MISSING_MEMBER(item, "accesses");
+        policy_item pi;
+        for (const auto &access : item["accesses"].GetArray()) {
+            CONTINUE_IF_MISSING_MEMBER(access, "isAllowed");
+            CONTINUE_IF_MISSING_MEMBER(access, "type");
+            if (access["isAllowed"].GetBool()) {
+                std::string type = access["type"].GetString();
+                std::transform(type.begin(), type.end(), type.begin(), 
toupper);
+                pi.access_types |= access_type_maping[type];

Review Comment:
   Oh, there may be other ways to define the Range Service. there may be 
different access_type. I will ignore them directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to