diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-05-13 11:01:48 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-13 11:01:48 +1200 |
commit | 713d6c55a007aa80850810f447308976516bfa63 (patch) | |
tree | 057e9147e724a56b6e2f3820fcf3d9ab67561fdf /src/org/traccar/database/PermissionsManager.java | |
parent | 51920cae6438f8888090f177761a82afff33067f (diff) | |
parent | 6c17f85d04b224ff2a09265918765c9f4fc8cf94 (diff) | |
download | trackermap-server-713d6c55a007aa80850810f447308976516bfa63.tar.gz trackermap-server-713d6c55a007aa80850810f447308976516bfa63.tar.bz2 trackermap-server-713d6c55a007aa80850810f447308976516bfa63.zip |
Merge pull request #3156 from Abyss777/computed_attributes
Implement computed attributes
Diffstat (limited to 'src/org/traccar/database/PermissionsManager.java')
-rw-r--r-- | src/org/traccar/database/PermissionsManager.java | 12 |
1 files changed, 12 insertions, 0 deletions
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); |