diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-27 17:06:27 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-27 17:06:27 +1200 |
commit | 4aea55186a2374350f825cf2008847ce4c5ae87c (patch) | |
tree | f688bfea239bfc3985389f1ccffc2d0f1e32275f | |
parent | 2738665b298f3b8de33f96c893ae40ac5d6d25d0 (diff) | |
download | traccar-server-4aea55186a2374350f825cf2008847ce4c5ae87c.tar.gz traccar-server-4aea55186a2374350f825cf2008847ce4c5ae87c.tar.bz2 traccar-server-4aea55186a2374350f825cf2008847ce4c5ae87c.zip |
Rename admin to administrator (fix #3858)
-rw-r--r-- | schema/changelog-3.17.xml | 12 | ||||
-rw-r--r-- | schema/changelog-3.3.xml | 4 | ||||
-rw-r--r-- | src/org/traccar/database/LdapProvider.java | 2 | ||||
-rw-r--r-- | src/org/traccar/database/PermissionsManager.java | 4 | ||||
-rw-r--r-- | src/org/traccar/model/User.java | 10 |
5 files changed, 22 insertions, 10 deletions
diff --git a/schema/changelog-3.17.xml b/schema/changelog-3.17.xml index ef296fe25..54c3db531 100644 --- a/schema/changelog-3.17.xml +++ b/schema/changelog-3.17.xml @@ -6,6 +6,18 @@ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd" logicalFilePath="changelog-3.17"> + <changeSet author="author" id="changelog-3.3-admin"> + + <preConditions onFail="MARK_RAN"> + <not> + <columnExists tableName="administrator" columnName="admin" /> + </not> + </preConditions> + + <renameColumn tableName="users" columnDataType="BOOLEAN" oldColumnName="admin" newColumnName="administrator" /> + + </changeSet> + <changeSet author="author" id="changelog-3.17"> <addColumn tableName="events"> diff --git a/schema/changelog-3.3.xml b/schema/changelog-3.3.xml index 6ed8cecaa..e5f29c661 100644 --- a/schema/changelog-3.3.xml +++ b/schema/changelog-3.3.xml @@ -33,7 +33,7 @@ <column name="readonly" type="BOOLEAN" defaultValueBoolean="false"> <constraints nullable="false" /> </column> - <column name="admin" type="BOOLEAN" defaultValueBoolean="false"> + <column name="administrator" type="BOOLEAN" defaultValueBoolean="false"> <constraints nullable="false" /> </column> <column name="map" type="VARCHAR(128)" defaultValue="osm"> @@ -181,7 +181,7 @@ <column name="email" value="admin" /> <column name="hashedpassword" value="D33DCA55ABD4CC5BC76F2BC0B4E603FE2C6F61F4C1EF2D47" /> <column name="salt" value="000000000000000000000000000000000000000000000000" /> - <column name="admin" valueBoolean="true" /> + <column name="administrator" valueBoolean="true" /> </insert> </changeSet> diff --git a/src/org/traccar/database/LdapProvider.java b/src/org/traccar/database/LdapProvider.java index 44dd386ed..eb975ad0f 100644 --- a/src/org/traccar/database/LdapProvider.java +++ b/src/org/traccar/database/LdapProvider.java @@ -150,7 +150,7 @@ public class LdapProvider { user.setEmail(accountName); } } - user.setAdmin(isAdmin(accountName)); + user.setAdministrator(isAdmin(accountName)); } catch (NamingException e) { user.setLogin(accountName); user.setName(accountName); diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index b5f062d2b..1c19f2374 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -156,7 +156,7 @@ public class PermissionsManager { public boolean getUserAdmin(long userId) { User user = getUser(userId); - return user != null && user.getAdmin(); + return user != null && user.getAdministrator(); } public void checkAdmin(long userId) throws SecurityException { @@ -258,7 +258,7 @@ public class PermissionsManager { } public void checkUserUpdate(long userId, User before, User after) throws SecurityException { - if (before.getAdmin() != after.getAdmin() + if (before.getAdministrator() != after.getAdministrator() || before.getDeviceLimit() != after.getDeviceLimit() || before.getUserLimit() != after.getUserLimit()) { checkAdmin(userId); diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 1a131a4e8..99e12a072 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -75,14 +75,14 @@ public class User extends ExtendedModel { this.readonly = readonly; } - private boolean admin; + private boolean administrator; - public boolean getAdmin() { - return admin; + public boolean getAdministrator() { + return administrator; } - public void setAdmin(boolean admin) { - this.admin = admin; + public void setAdministrator(boolean administrator) { + this.administrator = administrator; } private String map; |