Skip to content

Commit

Permalink
Rename admin to administrator (fix #3858)
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Apr 27, 2018
1 parent 2738665 commit 4aea551
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
12 changes: 12 additions & 0 deletions schema/changelog-3.17.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
4 changes: 2 additions & 2 deletions schema/changelog-3.3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/org/traccar/database/LdapProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public User getUser(String accountName) {
user.setEmail(accountName);
}
}
user.setAdmin(isAdmin(accountName));
user.setAdministrator(isAdmin(accountName));
} catch (NamingException e) {
user.setLogin(accountName);
user.setName(accountName);
Expand Down
4 changes: 2 additions & 2 deletions src/org/traccar/database/PermissionsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public final void refreshDeviceAndGroupPermissions() {

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 {
Expand Down Expand Up @@ -258,7 +258,7 @@ public void checkUserEnabled(long userId) throws SecurityException {
}

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);
Expand Down
10 changes: 5 additions & 5 deletions src/org/traccar/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ public void setReadonly(boolean readonly) {
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;
Expand Down

0 comments on commit 4aea551

Please sign in to comment.