Expose display name and locales when user has ANY admin role (#27160)

* chore: expose display name and locales when user has view-realm

Signed-off-by: Peter Keuter <github@peterkeuter.nl>

* fix: supportedlocales are available as stream

Signed-off-by: Peter Keuter <github@peterkeuter.nl>

* fix: tests

Signed-off-by: Peter Keuter <github@peterkeuter.nl>

* fix: remove unnecessarily added ignore

Signed-off-by: Peter Keuter <github@peterkeuter.nl>

---------

Signed-off-by: Peter Keuter <github@peterkeuter.nl>
This commit is contained in:
Peter Keuter 2024-02-21 19:30:31 +01:00 committed by GitHub
parent daa6cf5951
commit 01d66a662b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -380,6 +380,10 @@ public class RealmAdminResource {
RealmRepresentation rep = new RealmRepresentation();
rep.setRealm(realm.getName());
rep.setDefaultLocale(realm.getDefaultLocale());
rep.setDisplayName(realm.getDisplayName());
rep.setDisplayNameHtml(realm.getDisplayNameHtml());
rep.setSupportedLocales(realm.getSupportedLocalesStream().collect(Collectors.toSet()));
if (auth.users().canView()) {
rep.setRegistrationEmailAsUsername(realm.isRegistrationEmailAsUsername());

View file

@ -2057,7 +2057,8 @@ public class PermissionsTest extends AbstractKeycloakTest {
}
private void assertGettersEmpty(RealmRepresentation rep) {
assertGettersEmpty(rep, "getRealm", "getAttributesOrEmpty");
assertGettersEmpty(rep, "getRealm", "getAttributesOrEmpty", "getDisplayNameHtml",
"getDisplayName", "getDefaultLocale", "getSupportedLocales");
}
private void assertGettersEmpty(ClientRepresentation rep) {