diff --git a/api/src/main/java/org/openmrs/api/context/UserContext.java b/api/src/main/java/org/openmrs/api/context/UserContext.java index 8539b89be731..983f262f2feb 100755 --- a/api/src/main/java/org/openmrs/api/context/UserContext.java +++ b/api/src/main/java/org/openmrs/api/context/UserContext.java @@ -325,7 +325,7 @@ public Set getAllRoles(User user) throws Exception { public boolean hasPrivilege(String privilege) { log.debug("Checking '{}' against proxies: {}", privilege, proxies); // check proxied privileges - for (String s : proxies) { + for (String s : new ArrayList<>(proxies)) { if (s.equals(privilege)) { notifyPrivilegeListeners(getAuthenticatedUser(), privilege, true); return true;