aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 11:00:17 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-01 11:00:17 +1300
commit7575edbee87f9fbe4770c988b469f5915d85bb51 (patch)
treedd71bd4288976fc8f2bdf146d27c5d4964a15217 /src/org/traccar/api/resource
parent2ba060bc29ee529c5492b098b21927e15d815cb1 (diff)
downloadtrackermap-server-7575edbee87f9fbe4770c988b469f5915d85bb51.tar.gz
trackermap-server-7575edbee87f9fbe4770c988b469f5915d85bb51.tar.bz2
trackermap-server-7575edbee87f9fbe4770c988b469f5915d85bb51.zip
Move role definitions to user model
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/DeviceResource.java12
-rw-r--r--src/org/traccar/api/resource/UserResource.java11
2 files changed, 11 insertions, 12 deletions
diff --git a/src/org/traccar/api/resource/DeviceResource.java b/src/org/traccar/api/resource/DeviceResource.java
index 4152bcf81..98f1d1cca 100644
--- a/src/org/traccar/api/resource/DeviceResource.java
+++ b/src/org/traccar/api/resource/DeviceResource.java
@@ -28,8 +28,8 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.traccar.api.ApplicationRole;
import org.traccar.model.Device;
+import org.traccar.model.User;
@Path("devices")
@Produces(MediaType.APPLICATION_JSON)
@@ -37,7 +37,7 @@ import org.traccar.model.Device;
public class DeviceResource extends BaseResource<Device, Long> {
@GET
- @RolesAllowed(ApplicationRole.ADMIN)
+ @RolesAllowed(User.ROLE_ADMIN)
@Override
public Collection<Device> getEntities() {
return super.getEntities();
@@ -45,14 +45,14 @@ public class DeviceResource extends BaseResource<Device, Long> {
@GET
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Device getEntity(@PathParam("id") Long id) {
return super.getEntity(id);
}
@POST
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response postEntity(Device entity) {
return super.postEntity(entity);
@@ -60,7 +60,7 @@ public class DeviceResource extends BaseResource<Device, Long> {
@PUT
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response putEntity(@PathParam("id") Long id, Device entity) {
return super.putEntity(id, entity);
@@ -68,7 +68,7 @@ public class DeviceResource extends BaseResource<Device, Long> {
@DELETE
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response deleteEntity(@PathParam("id") Long id) {
return super.deleteEntity(id);
diff --git a/src/org/traccar/api/resource/UserResource.java b/src/org/traccar/api/resource/UserResource.java
index da615e052..d2964c983 100644
--- a/src/org/traccar/api/resource/UserResource.java
+++ b/src/org/traccar/api/resource/UserResource.java
@@ -27,7 +27,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.traccar.api.ApplicationRole;
import org.traccar.api.BaseResource;
import org.traccar.model.User;
@@ -37,7 +36,7 @@ import org.traccar.model.User;
public class UserResource extends BaseResource<User, Long> {
@GET
- @RolesAllowed(ApplicationRole.ADMIN)
+ @RolesAllowed(User.ROLE_ADMIN)
@Override
public Collection<User> getEntities() {
return super.getEntities();
@@ -45,14 +44,14 @@ public class UserResource extends BaseResource<User, Long> {
@GET
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public User getEntity(@PathParam("id") Long id) {
return super.getEntity(id);
}
@POST
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response postEntity(User entity) {
return super.postEntity(entity);
@@ -60,7 +59,7 @@ public class UserResource extends BaseResource<User, Long> {
@PUT
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response putEntity(@PathParam("id") Long id, User entity) {
return super.putEntity(id, entity);
@@ -68,7 +67,7 @@ public class UserResource extends BaseResource<User, Long> {
@DELETE
@Path("{id}")
- @RolesAllowed({ApplicationRole.ADMIN, ApplicationRole.USER})
+ @RolesAllowed(User.ROLE_USER)
@Override
public Response deleteEntity(@PathParam("id") Long id) {
return super.deleteEntity(id);