diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-18 16:52:31 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-18 16:52:31 -0700 |
commit | 8bc3c8c7d2c762ec00bfb1960dcd02171b7312a6 (patch) | |
tree | 5f26a6e5f252803ccde9eaffe42b7d5a19990db2 | |
parent | cf2583cec5f6b9c92730bdcdc5805944ff0bfa59 (diff) | |
download | trackermap-server-8bc3c8c7d2c762ec00bfb1960dcd02171b7312a6.tar.gz trackermap-server-8bc3c8c7d2c762ec00bfb1960dcd02171b7312a6.tar.bz2 trackermap-server-8bc3c8c7d2c762ec00bfb1960dcd02171b7312a6.zip |
Disable email change (fix #3878)
-rw-r--r-- | schema/changelog-5.3.xml | 21 | ||||
-rw-r--r-- | schema/changelog-master.xml | 1 | ||||
-rw-r--r-- | src/main/java/org/traccar/api/security/PermissionsService.java | 6 | ||||
-rw-r--r-- | src/main/java/org/traccar/model/Server.java | 11 | ||||
-rw-r--r-- | src/main/java/org/traccar/model/User.java | 15 | ||||
-rw-r--r-- | src/main/java/org/traccar/model/UserRestrictions.java | 1 |
6 files changed, 52 insertions, 3 deletions
diff --git a/schema/changelog-5.3.xml b/schema/changelog-5.3.xml new file mode 100644 index 000000000..b574a67d2 --- /dev/null +++ b/schema/changelog-5.3.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<databaseChangeLog + xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog + http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd" + logicalFilePath="changelog-5.3"> + + <changeSet author="author" id="changelog-5.3"> + + <addColumn tableName="tc_servers"> + <column name="fixedemail" type="BOOLEAN" defaultValueBoolean="false" /> + </addColumn> + + <addColumn tableName="tc_users"> + <column name="fixedemail" type="BOOLEAN" defaultValueBoolean="false" /> + </addColumn> + + </changeSet> + +</databaseChangeLog> diff --git a/schema/changelog-master.xml b/schema/changelog-master.xml index 83a1ac865..cea15397d 100644 --- a/schema/changelog-master.xml +++ b/schema/changelog-master.xml @@ -33,5 +33,6 @@ <include file="changelog-5.0.xml" relativeToChangelogFile="true" /> <include file="changelog-5.1.xml" relativeToChangelogFile="true" /> <include file="changelog-5.2.xml" relativeToChangelogFile="true" /> + <include file="changelog-5.3.xml" relativeToChangelogFile="true" /> </databaseChangeLog> diff --git a/src/main/java/org/traccar/api/security/PermissionsService.java b/src/main/java/org/traccar/api/security/PermissionsService.java index a3e7a182f..a494c0257 100644 --- a/src/main/java/org/traccar/api/security/PermissionsService.java +++ b/src/main/java/org/traccar/api/security/PermissionsService.java @@ -166,13 +166,17 @@ public class PermissionsService { || before.getDeviceReadonly() != after.getDeviceReadonly() || before.getDisabled() != after.getDisabled() || before.getLimitCommands() != after.getLimitCommands() - || before.getDisableReports() != after.getDisableReports()) { + || before.getDisableReports() != after.getDisableReports() + || before.getFixedEmail() != after.getFixedEmail()) { if (userId == after.getId()) { checkAdmin(userId); } else { checkUser(userId, after.getId()); } } + if (before.getFixedEmail() && !before.getEmail().equals(after.getEmail())) { + checkAdmin(userId); + } } public <T extends BaseModel> void checkPermission( diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java index e39da1b16..9e248e7bb 100644 --- a/src/main/java/org/traccar/model/Server.java +++ b/src/main/java/org/traccar/model/Server.java @@ -177,6 +177,17 @@ public class Server extends ExtendedModel implements UserRestrictions { this.disableReports = disableReports; } + private boolean fixedEmail; + + @Override + public boolean getFixedEmail() { + return fixedEmail; + } + + public void setFixedEmail(boolean fixedEmail) { + this.fixedEmail = fixedEmail; + } + private String poiLayer; public String getPoiLayer() { diff --git a/src/main/java/org/traccar/model/User.java b/src/main/java/org/traccar/model/User.java index 9dd84ad14..0aa67168f 100644 --- a/src/main/java/org/traccar/model/User.java +++ b/src/main/java/org/traccar/model/User.java @@ -232,8 +232,6 @@ public class User extends ExtendedModel implements UserRestrictions { this.limitCommands = limitCommands; } - private String poiLayer; - private boolean disableReports; @Override @@ -245,6 +243,19 @@ public class User extends ExtendedModel implements UserRestrictions { this.disableReports = disableReports; } + private boolean fixedEmail; + + @Override + public boolean getFixedEmail() { + return fixedEmail; + } + + public void setFixedEmail(boolean fixedEmail) { + this.fixedEmail = fixedEmail; + } + + private String poiLayer; + public String getPoiLayer() { return poiLayer; } diff --git a/src/main/java/org/traccar/model/UserRestrictions.java b/src/main/java/org/traccar/model/UserRestrictions.java index 2e4e5e363..1fcc5682e 100644 --- a/src/main/java/org/traccar/model/UserRestrictions.java +++ b/src/main/java/org/traccar/model/UserRestrictions.java @@ -20,4 +20,5 @@ public interface UserRestrictions { boolean getDeviceReadonly(); boolean getLimitCommands(); boolean getDisableReports(); + boolean getFixedEmail(); } |