From f77912f14ed17bfbe533b664b6b82154c80e3b58 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 21 Jul 2017 11:55:38 +0500 Subject: - Combine all permissions to one resource - Add two helpers to BaseResource --- src/org/traccar/api/resource/AttributeResource.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/org/traccar/api/resource/AttributeResource.java') diff --git a/src/org/traccar/api/resource/AttributeResource.java b/src/org/traccar/api/resource/AttributeResource.java index 2f731e3a7..c6c95e05c 100644 --- a/src/org/traccar/api/resource/AttributeResource.java +++ b/src/org/traccar/api/resource/AttributeResource.java @@ -19,7 +19,6 @@ package org.traccar.api.resource; import java.sql.SQLException; import java.util.Collection; import java.util.HashSet; -import java.util.LinkedHashMap; import java.util.Set; import javax.ws.rs.Consumes; @@ -86,11 +85,9 @@ public class AttributeResource extends BaseResource { } private Response add(Attribute entity) throws SQLException { + Context.getPermissionsManager().checkReadonly(getUserId()); Context.getAttributesManager().addItem(entity); - LinkedHashMap link = new LinkedHashMap<>(); - link.put("userId", getUserId()); - link.put("attributeId", entity.getId()); - Context.getDataManager().linkObject(link, true); + linkNew(entity); Context.getAttributesManager().refreshUserItems(); return Response.ok(entity).build(); } -- cgit v1.2.3