Github user rdhabalia commented on a diff in the pull request:
https://github.com/apache/incubator-pulsar/pull/530#discussion_r124126966
--- 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 --
Ok. So, then should we document it that wild-card only works with prefix
and suffix. because user may expect wild-card works in any position.
---
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.
---