Disable email change (fix #3878)

This commit is contained in:
Anton Tananaev
2022-07-18 16:52:31 -07:00
parent cf2583cec5
commit 8bc3c8c7d2
6 changed files with 52 additions and 3 deletions

21
schema/changelog-5.3.xml Normal file
View File

@@ -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>

View File

@@ -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>

View File

@@ -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(

View File

@@ -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() {

View File

@@ -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;
}

View File

@@ -20,4 +20,5 @@ public interface UserRestrictions {
boolean getDeviceReadonly();
boolean getLimitCommands();
boolean getDisableReports();
boolean getFixedEmail();
}