Skip to content

Commit

Permalink
Remove unassigned keys when user type changes.
Browse files Browse the repository at this point in the history
Remove unassigned keys when user type changes. Fixes bastillion-io#118
  • Loading branch information
skavanagh committed Nov 28, 2015
1 parent e543f43 commit 04d2ad4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/keybox/manage/db/UserDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ public static void updateUserNoCredentials(User user) {
stmt.setLong(6, user.getId());
stmt.execute();
DBUtils.closeStmt(stmt);
if (User.ADMINISTRATOR.equals(user.getUserType())) {
PublicKeyDB.deleteUnassignedKeysByUser(con, user.getId());
}

} catch (Exception e) {
log.error(e.toString(), e);
Expand Down Expand Up @@ -307,6 +310,9 @@ public static void updateUserCredentials(User user) {
stmt.setLong(8, user.getId());
stmt.execute();
DBUtils.closeStmt(stmt);
if(User.ADMINISTRATOR.equals(user.getUserType())) {
PublicKeyDB.deleteUnassignedKeysByUser(con, user.getId());
}

} catch (Exception e) {
log.error(e.toString(), e);
Expand Down

0 comments on commit 04d2ad4

Please sign in to comment.