Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
fixed permissions duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
mvivancheva9 committed Sep 2, 2016
1 parent 22c48a9 commit 24a5154
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ public List<Permission> getUniqueUserGroupPermissions(User user) {
for (Permission userGroupPermissionFromDb : userGroupPermissionsFromDb) {
boolean isPermissionPresent = false;
for (Permission userPersmission : user.getPermissions()) {
if (userGroupPermissionFromDb.getPermissionScope() == userPersmission.getPermissionScope() &&
userGroupPermissionFromDb.getPermittedEntityId().equals(userPersmission.getPermittedEntityId()) &&
userGroupPermissionFromDb.getPermissionType() == userPersmission.getPermissionType()) {
if (userGroupPermissionFromDb.getPermittedEntityId().equals(userPersmission.getPermittedEntityId())) {
isPermissionPresent = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Server/src/main/java/net/hawkengine/ws/WsEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void onWebSocketText(String message) {
User currentUser = (User) this.userService.getById(this.loggedUser.getId()).getObject();

this.setLoggedUser(currentUser);
this.loggedUser.getPermissions().addAll(this.permissionService.getUniqueUserGroupPermissions(this.loggedUser));
this.loggedUser.getPermissions().addAll(this.permissionService.getUniqueUserGroupPermissions(currentUser));

List<Permission> orderedPermissions = this.permissionService.sortPermissions(this.loggedUser.getPermissions());

Expand Down

0 comments on commit 24a5154

Please sign in to comment.