Minro change, added global to user specific cascading
This commit is contained in:
+13
-11
@@ -112,19 +112,21 @@ class AuthorizationsCollector implements IAuthorizator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean canDoOperation(String topic, Authorization.Permission permission, String username) {
|
private boolean canDoOperation(String topic, Authorization.Permission permission, String username) {
|
||||||
if (username == null || username.isEmpty()) {
|
for (Authorization auth : m_globalAuthorizations) {
|
||||||
for (Authorization auth : m_globalAuthorizations) {
|
if (auth.permission == permission || auth.permission == READWRITE) {
|
||||||
if (auth.permission == permission || auth.permission == READWRITE) {
|
if (SubscriptionsStore.matchTopics(topic, auth.topic)) {
|
||||||
if (SubscriptionsStore.matchTopics(topic, auth.topic)) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (m_userAuthorizations.containsKey(username)) {
|
}
|
||||||
for (Authorization auth : m_userAuthorizations.get(username)) {
|
|
||||||
if (auth.permission == permission || auth.permission == READWRITE) {
|
if (username != null && !username.isEmpty()) {
|
||||||
if (SubscriptionsStore.matchTopics(topic, auth.topic)) {
|
if (m_userAuthorizations.containsKey(username)) {
|
||||||
return true;
|
for (Authorization auth : m_userAuthorizations.get(username)) {
|
||||||
|
if (auth.permission == permission || auth.permission == READWRITE) {
|
||||||
|
if (SubscriptionsStore.matchTopics(topic, auth.topic)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user