diff options
Diffstat (limited to 'src/org/traccar/api/resource/UserResource.java')
-rw-r--r-- | src/org/traccar/api/resource/UserResource.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/org/traccar/api/resource/UserResource.java b/src/org/traccar/api/resource/UserResource.java index d3d82f99d..deb2dd2b4 100644 --- a/src/org/traccar/api/resource/UserResource.java +++ b/src/org/traccar/api/resource/UserResource.java @@ -49,17 +49,16 @@ public class UserResource extends BaseResource { Set<Long> result = null; if (Context.getPermissionsManager().isAdmin(getUserId())) { if (userId != 0) { - result = usersManager.getManagedItems(userId); + result = usersManager.getUserItems(userId); } else { result = usersManager.getAllItems(); } } else if (Context.getPermissionsManager().isManager(getUserId())) { result = usersManager.getManagedItems(getUserId()); - result.add(getUserId()); } else { throw new SecurityException("Admin or manager access required"); } - return usersManager.getItems(User.class, result); + return usersManager.getItems(result); } @PermitAll @@ -110,12 +109,8 @@ public class UserResource extends BaseResource { Context.getPermissionsManager().checkReadonly(getUserId()); Context.getPermissionsManager().checkUser(getUserId(), id); Context.getUsersManager().removeItem(id); - if (Context.getGeofenceManager() != null) { - Context.getGeofenceManager().refreshUserItems(); - } - if (Context.getNotificationManager() != null) { - Context.getNotificationManager().refresh(); - } + Context.getPermissionsManager().refreshDeviceAndGroupPermissions(); + Context.getPermissionsManager().refreshAllUsersPermissions(); return Response.noContent().build(); } |