diff options
author | Abyss777 <abyss@fox5.ru> | 2017-07-11 17:33:33 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-07-11 17:33:33 +0500 |
commit | 0588389bee46910392d4bb0f017b5bae61581e78 (patch) | |
tree | 7beb6d7b3bed8d43916ddb6e384e7ce3f5abd06e /src/org/traccar/database/PermissionsManager.java | |
parent | 7863a5ca3358cef028b77188538a0893a737ddbf (diff) | |
download | trackermap-server-0588389bee46910392d4bb0f017b5bae61581e78.tar.gz trackermap-server-0588389bee46910392d4bb0f017b5bae61581e78.tar.bz2 trackermap-server-0588389bee46910392d4bb0f017b5bae61581e78.zip |
Implement DriverResource
Diffstat (limited to 'src/org/traccar/database/PermissionsManager.java')
-rw-r--r-- | src/org/traccar/database/PermissionsManager.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index 9a82efd48..82ca6af49 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -322,6 +322,19 @@ public class PermissionsManager { } } + public void checkDriver(long userId, long driverId) throws SecurityException { + if (!Context.getDriversManager().checkDriver(userId, driverId) && !isAdmin(userId)) { + checkManager(userId); + for (long managedUserId : getUserPermissions(userId)) { + if (Context.getDriversManager().checkDriver(managedUserId, driverId)) { + return; + } + } + throw new SecurityException("Driver access denied"); + } + } + + public void checkCalendar(long userId, long calendarId) throws SecurityException { if (!Context.getCalendarManager().checkCalendar(userId, calendarId) && !isAdmin(userId)) { checkManager(userId); |