From 6c17f85d04b224ff2a09265918765c9f4fc8cf94 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 10 May 2017 13:27:49 +0500 Subject: Implement computed attributes --- src/org/traccar/database/PermissionsManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/org/traccar/database/PermissionsManager.java') diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index e4bd6f5db..11f147c7c 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -310,6 +310,18 @@ public class PermissionsManager { } } + public void checkAttribute(long userId, long attributeId) throws SecurityException { + if (!Context.getAttributesManager().checkAttribute(userId, attributeId) && !isAdmin(userId)) { + checkManager(userId); + for (long managedUserId : getUserPermissions(userId)) { + if (Context.getAttributesManager().checkAttribute(managedUserId, attributeId)) { + return; + } + } + throw new SecurityException("Attribute access denied"); + } + } + public void checkCalendar(long userId, long calendarId) throws SecurityException { if (!Context.getCalendarManager().checkCalendar(userId, calendarId) && !isAdmin(userId)) { checkManager(userId); -- cgit v1.2.3