Skip to content

Commit 948cc92

Browse files
author
Lucianos Lionakis
committed
Add accolades to relevant if statemets
1 parent 9e394d0 commit 948cc92

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/service/UserService.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ public String[] getAdminGroups() {
9393

9494
// Support for old, non-array notation
9595
String singleGroup = environment.getProperty("proxy.admin-groups");
96-
if (singleGroup != null && !singleGroup.isEmpty()) adminGroups.add(singleGroup.toUpperCase());
96+
if (singleGroup != null && !singleGroup.isEmpty()) {
97+
adminGroups.add(singleGroup.toUpperCase());
98+
}
9799

98100
for (int i=0 ;; i++) {
99101
String groupName = environment.getProperty(String.format("proxy.admin-groups[%s]", i));
100-
if (groupName == null || groupName.isEmpty()) break;
102+
if (groupName == null || groupName.isEmpty()) {
103+
break;
104+
}
101105
adminGroups.add(groupName.toUpperCase());
102106
}
103107

@@ -109,11 +113,15 @@ public String[] getAdminUsers() {
109113

110114
// Support for old, non-array notation
111115
String singleUser = environment.getProperty("proxy.admin-users");
112-
if (singleUser != null && !singleUser.isEmpty()) adminUsers.add(singleUser);
116+
if (singleUser != null && !singleUser.isEmpty()) {
117+
adminUsers.add(singleUser);
118+
}
113119

114120
for (int i=0 ;; i++) {
115121
String userName = environment.getProperty(String.format("proxy.admin-users[%s]", i));
116-
if (userName == null || userName.isEmpty()) break;
122+
if (userName == null || userName.isEmpty()) {
123+
break;
124+
}
117125
adminUsers.add(userName);
118126
}
119127

@@ -146,12 +154,16 @@ public boolean isAdmin(Authentication auth) {
146154
}
147155

148156
for (String adminGroup: getAdminGroups()) {
149-
if (isMember(auth, adminGroup)) return true;
157+
if (isMember(auth, adminGroup)) {
158+
return true;
159+
}
150160
}
151161

152162
String userName = getUserId(auth);
153163
for (String adminUser: getAdminUsers()) {
154-
if (userName != null && userName.equals(adminUser)) return true;
164+
if (userName != null && userName.equals(adminUser)) {
165+
return true;
166+
}
155167
}
156168
return false;
157169
}

0 commit comments

Comments
 (0)