diff --git a/src/main/java/com/faendir/acra/model/User.java b/src/main/java/com/faendir/acra/model/User.java index 0d4393d..0b07673 100644 --- a/src/main/java/com/faendir/acra/model/User.java +++ b/src/main/java/com/faendir/acra/model/User.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.faendir.acra.model; import org.springframework.data.annotation.PersistenceConstructor; @@ -21,6 +20,7 @@ import org.springframework.lang.NonNull; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; +import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -41,8 +41,12 @@ import java.util.stream.Stream; public class User implements UserDetails { @Id private String username; @Enumerated(EnumType.STRING) - @ElementCollection(fetch = FetchType.EAGER) private Set roles; - @ElementCollection(fetch = FetchType.EAGER) private Set permissions; + @Column(nullable = false) + @ElementCollection(fetch = FetchType.EAGER) + private Set roles; + @Column(nullable = false) + @ElementCollection(fetch = FetchType.EAGER) + private Set permissions; private String password; @PersistenceConstructor diff --git a/src/main/java/com/faendir/acra/ui/view/user/UserManagerView.java b/src/main/java/com/faendir/acra/ui/view/user/UserManagerView.java index 005a57a..9be6019 100644 --- a/src/main/java/com/faendir/acra/ui/view/user/UserManagerView.java +++ b/src/main/java/com/faendir/acra/ui/view/user/UserManagerView.java @@ -91,7 +91,10 @@ public class UserManagerView extends BaseView { ComboBox levelComboBox = new ComboBox<>(null, Arrays.asList(Permission.Level.values())); levelComboBox.setEmptySelectionAllowed(false); levelComboBox.setValue(permission); - levelComboBox.addValueChangeListener(e -> userService.setPermission(user, app, e.getValue())); + levelComboBox.addValueChangeListener(e -> { + userService.setPermission(user, app, e.getValue()); + userGrid.getDataProvider().refreshAll(); + }); return levelComboBox; }, new ComponentRenderer(), Messages.ACCESS_PERMISSION, app.getName()); } diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 12af56a..2e1a640 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -616,4 +616,12 @@ databaseChangeLog: type: INT constraints: nullable: false +- changeSet: + id: 2018-08-24-fix-permission-key + author: lukas + changes: + - addPrimaryKey: + columnNames: user_username, app_id + tableName: user_permissions + constraintName: PK_user_permissions