diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-23 18:29:36 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-23 18:29:36 +1200 |
commit | 4b2372336d0496c85befe099914434e5b68f05b3 (patch) | |
tree | 798de625a07c18287e829b3a037cacee179ebcff /src/org/traccar/api/resource/GroupResource.java | |
parent | ba82047a492be54545961716814584d8880d28ae (diff) | |
parent | 5a65c0d6be8ffc2db0ffdb0c35ecedfb2b3750c7 (diff) | |
download | trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.gz trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.tar.bz2 trackermap-server-4b2372336d0496c85befe099914434e5b68f05b3.zip |
Merge pull request #3373 from Abyss777/refactor_managers
Refactor managers, permissions etc
Diffstat (limited to 'src/org/traccar/api/resource/GroupResource.java')
-rw-r--r-- | src/org/traccar/api/resource/GroupResource.java | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/org/traccar/api/resource/GroupResource.java b/src/org/traccar/api/resource/GroupResource.java index ceba69105..f20c95327 100644 --- a/src/org/traccar/api/resource/GroupResource.java +++ b/src/org/traccar/api/resource/GroupResource.java @@ -18,6 +18,7 @@ package org.traccar.api.resource; import org.traccar.Context; import org.traccar.api.BaseResource; import org.traccar.model.Group; +import org.traccar.model.User; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -61,11 +62,9 @@ public class GroupResource extends BaseResource { public Response add(Group entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); Context.getDeviceManager().addGroup(entity); - Context.getDataManager().linkGroup(getUserId(), entity.getId()); + Context.getDataManager().linkObject(User.class, getUserId(), entity.getClass(), entity.getId(), true); Context.getPermissionsManager().refreshPermissions(); - if (Context.getGeofenceManager() != null) { - Context.getGeofenceManager().refresh(); - } + Context.getPermissionsManager().refreshAllExtendedPermissions(); return Response.ok(entity).build(); } @@ -75,9 +74,7 @@ public class GroupResource extends BaseResource { Context.getPermissionsManager().checkReadonly(getUserId()); Context.getPermissionsManager().checkGroup(getUserId(), entity.getId()); Context.getDeviceManager().updateGroup(entity); - if (Context.getGeofenceManager() != null) { - Context.getGeofenceManager().refresh(); - } + Context.getPermissionsManager().refreshAllExtendedPermissions(); return Response.ok(entity).build(); } @@ -88,9 +85,7 @@ public class GroupResource extends BaseResource { Context.getPermissionsManager().checkGroup(getUserId(), id); Context.getDeviceManager().removeGroup(id); Context.getPermissionsManager().refreshPermissions(); - if (Context.getGeofenceManager() != null) { - Context.getGeofenceManager().refresh(); - } + Context.getPermissionsManager().refreshAllExtendedPermissions(); return Response.noContent().build(); } |