@Test public void testGetRequiredPermissions() { PatchDomain patchDomain = new PatchDomain(); assertEquals(Collections.emptySet(), patchDomain.getRequiredPermissions()); patchDomain.setName(Optional.of("patchName")); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setDescription(Optional.of("patchDescription")); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setEnabled(Optional.of(true)); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setPath(Optional.of("patchPath")); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setLoginSettings(Optional.of(new LoginSettings())); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setAccountSettings(Optional.of(new AccountSettings())); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setTags(Optional.of(Collections.singleton("patchTag"))); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); PatchOIDCSettings oidcSettings = new PatchOIDCSettings(); patchDomain.setOidc(Optional.of(oidcSettings)); assertEquals(Collections.emptySet(), patchDomain.getRequiredPermissions()); oidcSettings.setClientRegistrationSettings(Optional.of(new PatchClientRegistrationSettings())); oidcSettings.setRedirectUriStrictMatching(Optional.of(true)); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_OPENID)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setScim(Optional.of(new SCIMSettings())); assertEquals(new HashSet<>(Arrays.asList( Permission.DOMAIN_SCIM)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setUma(Optional.of(new UMASettings())); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_UMA)), patchDomain.getRequiredPermissions()); patchDomain = new PatchDomain(); patchDomain.setPath(Optional.of("patchPath")); patchDomain.setOidc(Optional.of(oidcSettings)); patchDomain.setScim(Optional.of(new SCIMSettings())); assertEquals(new HashSet<>(Arrays.asList(Permission.DOMAIN_SETTINGS, Permission.DOMAIN_OPENID, Permission.DOMAIN_SCIM)), patchDomain.getRequiredPermissions()); }
public Set<Permission> getRequiredPermissions() { Set<Permission> requiredPermissions = new HashSet<>(); if (name != null && name.isPresent() || description != null && description.isPresent() || enabled != null && enabled.isPresent() || path != null && path.isPresent() || vhostMode != null && vhostMode.isPresent() || vhosts != null && vhosts.isPresent() || loginSettings != null && loginSettings.isPresent() || webAuthnSettings != null && webAuthnSettings.isPresent() || accountSettings != null && accountSettings.isPresent() || tags != null && tags.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SETTINGS); } if (oidc != null && oidc.isPresent()) { requiredPermissions.addAll(oidc.get().getRequiredPermissions()); } if (uma != null && uma.isPresent()) { requiredPermissions.add(Permission.DOMAIN_UMA); } if (scim != null && scim.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SCIM); } return requiredPermissions; }
PatchDomain { public Set<Permission> getRequiredPermissions() { Set<Permission> requiredPermissions = new HashSet<>(); if (name != null && name.isPresent() || description != null && description.isPresent() || enabled != null && enabled.isPresent() || path != null && path.isPresent() || vhostMode != null && vhostMode.isPresent() || vhosts != null && vhosts.isPresent() || loginSettings != null && loginSettings.isPresent() || webAuthnSettings != null && webAuthnSettings.isPresent() || accountSettings != null && accountSettings.isPresent() || tags != null && tags.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SETTINGS); } if (oidc != null && oidc.isPresent()) { requiredPermissions.addAll(oidc.get().getRequiredPermissions()); } if (uma != null && uma.isPresent()) { requiredPermissions.add(Permission.DOMAIN_UMA); } if (scim != null && scim.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SCIM); } return requiredPermissions; } }
PatchDomain { public Set<Permission> getRequiredPermissions() { Set<Permission> requiredPermissions = new HashSet<>(); if (name != null && name.isPresent() || description != null && description.isPresent() || enabled != null && enabled.isPresent() || path != null && path.isPresent() || vhostMode != null && vhostMode.isPresent() || vhosts != null && vhosts.isPresent() || loginSettings != null && loginSettings.isPresent() || webAuthnSettings != null && webAuthnSettings.isPresent() || accountSettings != null && accountSettings.isPresent() || tags != null && tags.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SETTINGS); } if (oidc != null && oidc.isPresent()) { requiredPermissions.addAll(oidc.get().getRequiredPermissions()); } if (uma != null && uma.isPresent()) { requiredPermissions.add(Permission.DOMAIN_UMA); } if (scim != null && scim.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SCIM); } return requiredPermissions; } PatchDomain(); }
PatchDomain { public Set<Permission> getRequiredPermissions() { Set<Permission> requiredPermissions = new HashSet<>(); if (name != null && name.isPresent() || description != null && description.isPresent() || enabled != null && enabled.isPresent() || path != null && path.isPresent() || vhostMode != null && vhostMode.isPresent() || vhosts != null && vhosts.isPresent() || loginSettings != null && loginSettings.isPresent() || webAuthnSettings != null && webAuthnSettings.isPresent() || accountSettings != null && accountSettings.isPresent() || tags != null && tags.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SETTINGS); } if (oidc != null && oidc.isPresent()) { requiredPermissions.addAll(oidc.get().getRequiredPermissions()); } if (uma != null && uma.isPresent()) { requiredPermissions.add(Permission.DOMAIN_UMA); } if (scim != null && scim.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SCIM); } return requiredPermissions; } PatchDomain(); Optional<String> getName(); void setName(Optional<String> name); Optional<String> getDescription(); void setDescription(Optional<String> description); Optional<Boolean> getEnabled(); void setEnabled(Optional<Boolean> enabled); Optional<String> getPath(); void setPath(Optional<String> path); Optional<PatchOIDCSettings> getOidc(); void setOidc(Optional<PatchOIDCSettings> oidc); Optional<UMASettings> getUma(); void setUma(Optional<UMASettings> uma); Optional<SCIMSettings> getScim(); void setScim(Optional<SCIMSettings> scim); Optional<LoginSettings> getLoginSettings(); void setLoginSettings(Optional<LoginSettings> loginSettings); Optional<WebAuthnSettings> getWebAuthnSettings(); void setWebAuthnSettings(Optional<WebAuthnSettings> webAuthnSettings); Optional<AccountSettings> getAccountSettings(); void setAccountSettings(Optional<AccountSettings> accountSettings); Optional<Set<String>> getTags(); void setTags(Optional<Set<String>> tags); Domain patch(Domain _toPatch); Set<Permission> getRequiredPermissions(); Optional<Boolean> getVhostMode(); void setVhostMode(Optional<Boolean> vhostMode); Optional<List<VirtualHost>> getVhosts(); void setVhosts(Optional<List<VirtualHost>> vhosts); }
PatchDomain { public Set<Permission> getRequiredPermissions() { Set<Permission> requiredPermissions = new HashSet<>(); if (name != null && name.isPresent() || description != null && description.isPresent() || enabled != null && enabled.isPresent() || path != null && path.isPresent() || vhostMode != null && vhostMode.isPresent() || vhosts != null && vhosts.isPresent() || loginSettings != null && loginSettings.isPresent() || webAuthnSettings != null && webAuthnSettings.isPresent() || accountSettings != null && accountSettings.isPresent() || tags != null && tags.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SETTINGS); } if (oidc != null && oidc.isPresent()) { requiredPermissions.addAll(oidc.get().getRequiredPermissions()); } if (uma != null && uma.isPresent()) { requiredPermissions.add(Permission.DOMAIN_UMA); } if (scim != null && scim.isPresent()) { requiredPermissions.add(Permission.DOMAIN_SCIM); } return requiredPermissions; } PatchDomain(); Optional<String> getName(); void setName(Optional<String> name); Optional<String> getDescription(); void setDescription(Optional<String> description); Optional<Boolean> getEnabled(); void setEnabled(Optional<Boolean> enabled); Optional<String> getPath(); void setPath(Optional<String> path); Optional<PatchOIDCSettings> getOidc(); void setOidc(Optional<PatchOIDCSettings> oidc); Optional<UMASettings> getUma(); void setUma(Optional<UMASettings> uma); Optional<SCIMSettings> getScim(); void setScim(Optional<SCIMSettings> scim); Optional<LoginSettings> getLoginSettings(); void setLoginSettings(Optional<LoginSettings> loginSettings); Optional<WebAuthnSettings> getWebAuthnSettings(); void setWebAuthnSettings(Optional<WebAuthnSettings> webAuthnSettings); Optional<AccountSettings> getAccountSettings(); void setAccountSettings(Optional<AccountSettings> accountSettings); Optional<Set<String>> getTags(); void setTags(Optional<Set<String>> tags); Domain patch(Domain _toPatch); Set<Permission> getRequiredPermissions(); Optional<Boolean> getVhostMode(); void setVhostMode(Optional<Boolean> vhostMode); Optional<List<VirtualHost>> getVhosts(); void setVhosts(Optional<List<VirtualHost>> vhosts);  }