aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/CommandsManager.java2
-rw-r--r--src/org/traccar/database/PermissionsManager.java36
2 files changed, 19 insertions, 19 deletions
diff --git a/src/org/traccar/database/CommandsManager.java b/src/org/traccar/database/CommandsManager.java
index 9f97c929c..ded12e0d2 100644
--- a/src/org/traccar/database/CommandsManager.java
+++ b/src/org/traccar/database/CommandsManager.java
@@ -81,7 +81,7 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
}
}
- public Collection<Long> getProperCommands(long deviceId, boolean textChannel) {
+ public Collection<Long> getSupportedCommands(long deviceId, boolean textChannel) {
List<Long> result = new ArrayList<>();
Position lastPosition = Context.getIdentityManager().getLastPosition(deviceId);
for (long commandId : getAllDeviceItems(deviceId)) {
diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java
index 3da99dd13..0d9c780a6 100644
--- a/src/org/traccar/database/PermissionsManager.java
+++ b/src/org/traccar/database/PermissionsManager.java
@@ -137,24 +137,24 @@ public class PermissionsManager {
}
}
- public boolean isAdmin(long userId) {
+ public boolean getUserAdmin(long userId) {
User user = getUser(userId);
return user != null && user.getAdmin();
}
public void checkAdmin(long userId) throws SecurityException {
- if (!isAdmin(userId)) {
+ if (!getUserAdmin(userId)) {
throw new SecurityException("Admin access required");
}
}
- public boolean isManager(long userId) {
+ public boolean getUserManager(long userId) {
User user = getUser(userId);
return user != null && user.getUserLimit() != 0;
}
public void checkManager(long userId) throws SecurityException {
- if (!isManager(userId)) {
+ if (!getUserManager(userId)) {
throw new SecurityException("Manager access required");
}
}
@@ -177,7 +177,7 @@ public class PermissionsManager {
int deviceLimit = getUser(userId).getDeviceLimit();
if (deviceLimit != -1) {
int deviceCount = 0;
- if (isManager(userId)) {
+ if (getUserManager(userId)) {
deviceCount = Context.getDeviceManager().getManagedItems(userId).size();
} else {
deviceCount = Context.getDeviceManager().getUserItems(userId).size();
@@ -188,41 +188,41 @@ public class PermissionsManager {
}
}
- public boolean isReadonly(long userId) {
+ public boolean getUserReadonly(long userId) {
User user = getUser(userId);
return user != null && user.getReadonly();
}
- public boolean isDeviceReadonly(long userId) {
+ public boolean getUserDeviceReadonly(long userId) {
User user = getUser(userId);
return user != null && user.getDeviceReadonly();
}
- public boolean isLimitCommands(long userId) {
+ public boolean getUserLimitCommands(long userId) {
User user = getUser(userId);
return user != null && user.getLimitCommands();
}
public void checkReadonly(long userId) throws SecurityException {
- if (!isAdmin(userId) && (server.getReadonly() || isReadonly(userId))) {
+ if (!getUserAdmin(userId) && (server.getReadonly() || getUserReadonly(userId))) {
throw new SecurityException("Account is readonly");
}
}
public void checkDeviceReadonly(long userId) throws SecurityException {
- if (!isAdmin(userId) && (server.getDeviceReadonly() || isDeviceReadonly(userId))) {
+ if (!getUserAdmin(userId) && (server.getDeviceReadonly() || getUserDeviceReadonly(userId))) {
throw new SecurityException("Account is device readonly");
}
}
public void checkLimitCommands(long userId) throws SecurityException {
- if (!isAdmin(userId) && (server.getLimitCommands() || isLimitCommands(userId))) {
+ if (!getUserAdmin(userId) && (server.getLimitCommands() || getUserLimitCommands(userId))) {
throw new SecurityException("Account has limit sending commands");
}
}
public void checkUserDeviceCommand(long userId, long deviceId, long commandId) throws SecurityException {
- if (!isAdmin(userId) && Context.getCommandsManager().checkDeviceCommand(deviceId, commandId)) {
+ if (!getUserAdmin(userId) && Context.getCommandsManager().checkDeviceCommand(deviceId, commandId)) {
throw new SecurityException("Command can not be sent to this device");
}
}
@@ -258,20 +258,20 @@ public class PermissionsManager {
if (userId == after.getId()) {
checkAdmin(userId);
}
- if (!isAdmin(userId)) {
+ if (!getUserAdmin(userId)) {
checkManager(userId);
}
}
}
public void checkUser(long userId, long managedUserId) throws SecurityException {
- if (userId != managedUserId && !isAdmin(userId)) {
+ if (userId != managedUserId && !getUserAdmin(userId)) {
checkManager(userId, managedUserId);
}
}
public void checkGroup(long userId, long groupId) throws SecurityException {
- if (!getGroupPermissions(userId).contains(groupId) && !isAdmin(userId)) {
+ if (!getGroupPermissions(userId).contains(groupId) && !getUserAdmin(userId)) {
checkManager(userId);
for (long managedUserId : usersManager.getUserItems(userId)) {
if (getGroupPermissions(managedUserId).contains(groupId)) {
@@ -283,7 +283,7 @@ public class PermissionsManager {
}
public void checkDevice(long userId, long deviceId) throws SecurityException {
- if (!Context.getDeviceManager().getUserItems(userId).contains(deviceId) && !isAdmin(userId)) {
+ if (!Context.getDeviceManager().getUserItems(userId).contains(deviceId) && !getUserAdmin(userId)) {
checkManager(userId);
for (long managedUserId : usersManager.getUserItems(userId)) {
if (Context.getDeviceManager().getUserItems(managedUserId).contains(deviceId)) {
@@ -295,7 +295,7 @@ public class PermissionsManager {
}
public void checkRegistration(long userId) {
- if (!server.getRegistration() && !isAdmin(userId)) {
+ if (!server.getRegistration() && !getUserAdmin(userId)) {
throw new SecurityException("Registration disabled");
}
}
@@ -324,7 +324,7 @@ public class PermissionsManager {
throw new IllegalArgumentException("Unknown object type");
}
- if (manager != null && !manager.checkItemPermission(userId, objectId) && !isAdmin(userId)) {
+ if (manager != null && !manager.checkItemPermission(userId, objectId) && !getUserAdmin(userId)) {
checkManager(userId);
for (long managedUserId : usersManager.getManagedItems(userId)) {
if (manager.checkItemPermission(managedUserId, objectId)) {