public void applyUiPermissions(Frame container) {
Window window = container instanceof Window ? (Window) container : ComponentsHelper.getWindow(container);
if (window == null) {
log.warn(String.format("Unable to find window for container %s with id '%s'", container.getClass(), container.getId()));
return;
}
UserSession userSession = sessionSource.getUserSession();
String screenId = window.getId();
Map<String, Integer> uiPermissions = userSession.getPermissionsByType(PermissionType.UI);
for (Map.Entry<String, Integer> permissionEntry : uiPermissions.entrySet()) {
String target = permissionEntry.getKey();
String targetComponentId = getTargetComponentId(target, screenId);
if (targetComponentId != null) {
if (targetComponentId.contains("[")) {
applyCompositeComponentPermission(window, screenId, permissionEntry.getValue(), targetComponentId);
} else if (targetComponentId.contains(">")) {
applyComponentActionPermission(window, screenId, permissionEntry.getValue(), targetComponentId);
} else {
applyComponentPermission(window, screenId, permissionEntry.getValue(), targetComponentId);
}
}
}
}