You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by bh...@apache.org on 2019/07/23 14:01:23 UTC

[incubator-dlab] branch develop updated: DLAB-819 fixed bug connected with access denied

This is an automated email from the ASF dual-hosted git repository.

bhliva pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 78858cc  DLAB-819 fixed bug connected with access denied
78858cc is described below

commit 78858ccc25d27896caf5cb35ed95f3be1db0091d
Author: bhliva <bo...@epam.com>
AuthorDate: Tue Jul 23 17:01:09 2019 +0300

    DLAB-819 fixed bug connected with access denied
---
 .../main/java/com/epam/dlab/backendapi/roles/UserRoles.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/roles/UserRoles.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/roles/UserRoles.java
index a8800e2..0767c64 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/roles/UserRoles.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/roles/UserRoles.java
@@ -70,9 +70,9 @@ public class UserRoles {
 		LOGGER.trace("Loading roles from database...");
 		if (userRoles == null) {
 			userRoles = new UserRoles();
+			userRoles.load(dao, defaultAccess);
+			LOGGER.trace("New roles are	: {}", getRoles());
 		}
-		userRoles.load(dao, defaultAccess);
-		LOGGER.trace("New roles are: {}", getRoles());
 	}
 
 	/**
@@ -97,8 +97,12 @@ public class UserRoles {
 
 	public static boolean isAdmin(UserInfo userInfo) {
 		final List<UserRole> roles = UserRoles.getRoles();
-		return roles == null || roles.stream().anyMatch(r -> ADMIN_ROLE_NAME.equals(r.getId()) &&
+		if (roles == null || roles.isEmpty()) {
+			System.out.println("=============EMPTY==========");
+		}
+		final boolean b = roles == null || roles.stream().anyMatch(r -> ADMIN_ROLE_NAME.equals(r.getId()) &&
 				(userRoles.hasAccessByGroup(userInfo, r, userInfo.getRoles()) || userRoles.hasAccessByUserName(userInfo, r)));
+		return b;
 	}
 
 	/**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org