Github user yush1ga commented on a diff in the pull request:
https://github.com/apache/incubator-pulsar/pull/530#discussion_r124128740
--- Diff:
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationManager.java
---
@@ -177,6 +190,29 @@ private boolean checkCluster(DestinationName
destination) {
return permissionFuture;
}
+ private Boolean checkWildcardPermission(String checkedRole, AuthAction
checkedAction,
+ Map<String, Set<AuthAction>> permissionMap) {
+ for (Map.Entry<String, Set<AuthAction>> permissionData :
permissionMap.entrySet()) {
+ String permittedRole = permissionData.getKey();
+ Set<AuthAction> permittedActions = permissionData.getValue();
+
+ // Prefix match
+ if (permittedRole.charAt(permittedRole.length() - 1) == '*'
+ && checkedRole.startsWith(permittedRole.substring(0,
permittedRole.length() - 1))
+ && permittedActions.contains(checkedAction)) {
+ return true;
+ }
+
+ // Suffix match
+ if (permittedRole.charAt(0) == '*'
--- End diff --
Thanks for your advice.
I will state it explicitly in the document that I'm going to make after
merging this PR :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---