aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-23 08:47:44 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-23 09:00:11 +0500
commit529ce7aaced07f200a67d97b18b1c3ea4e0bff8d (patch)
treea2162ff07c6476fb35c0283de4b27154800243c1 /src/org
parentd2a2ce5d05572caadf13627d3e6c3767ad68688f (diff)
downloadtrackermap-server-529ce7aaced07f200a67d97b18b1c3ea4e0bff8d.tar.gz
trackermap-server-529ce7aaced07f200a67d97b18b1c3ea4e0bff8d.tar.bz2
trackermap-server-529ce7aaced07f200a67d97b18b1c3ea4e0bff8d.zip
Fix nested IFs
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/PermissionsManager.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java
index 8aa0dc9d7..b9cdfc36b 100644
--- a/src/org/traccar/database/PermissionsManager.java
+++ b/src/org/traccar/database/PermissionsManager.java
@@ -328,16 +328,14 @@ public class PermissionsManager {
throw new IllegalArgumentException("Unknown object type");
}
- if (manager != null) {
- if (manager.checkItemPermission(userId, objectId) && !isAdmin(userId)) {
- checkManager(userId);
- for (long managedUserId : getUserPermissions(userId)) {
- if (manager.checkItemPermission(managedUserId, objectId)) {
- return;
- }
+ if (manager != null && !manager.checkItemPermission(userId, objectId) && !isAdmin(userId)) {
+ checkManager(userId);
+ for (long managedUserId : getUserPermissions(userId)) {
+ if (manager.checkItemPermission(managedUserId, objectId)) {
+ return;
}
- throw new SecurityException("Type " + object + " access denied");
}
+ throw new SecurityException("Type " + object + " access denied");
}
}
@@ -357,10 +355,8 @@ public class PermissionsManager {
refreshAllExtendedPermissions();
} else if (permission.getPropertyClass().equals(ManagedUser.class)) {
refreshUserPermissions();
- } else if (permission.getPropertyClass().equals(Geofence.class)) {
- if (Context.getGeofenceManager() != null) {
- Context.getGeofenceManager().refreshUserItems();
- }
+ } else if (permission.getPropertyClass().equals(Geofence.class) && Context.getGeofenceManager() != null) {
+ Context.getGeofenceManager().refreshUserItems();
} else if (permission.getPropertyClass().equals(Driver.class)) {
Context.getDriversManager().refreshUserItems();
} else if (permission.getPropertyClass().equals(Attribute.class)) {
@@ -368,12 +364,9 @@ public class PermissionsManager {
} else if (permission.getPropertyClass().equals(Calendar.class)) {
Context.getCalendarManager().refreshUserItems();
}
- } else if (permission.getOwnerClass().equals(Device.class)
- || permission.getOwnerClass().equals(Group.class)) {
- if (permission.getPropertyClass().equals(Geofence.class)) {
- if (Context.getGeofenceManager() != null) {
- Context.getGeofenceManager().refreshExtendedPermissions();
- }
+ } else if (permission.getOwnerClass().equals(Device.class) || permission.getOwnerClass().equals(Group.class)) {
+ if (permission.getPropertyClass().equals(Geofence.class) && Context.getGeofenceManager() != null) {
+ Context.getGeofenceManager().refreshExtendedPermissions();
} else if (permission.getPropertyClass().equals(Driver.class)) {
Context.getDriversManager().refreshExtendedPermissions();
} else if (permission.getPropertyClass().equals(Attribute.class)) {