component query and remove provider alis fix
This commit is contained in:
parent
cfbd7d469f
commit
88d08c4f38
4 changed files with 14 additions and 3 deletions
|
@ -46,6 +46,12 @@ public interface ComponentsResource {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public List<ComponentRepresentation> query(@QueryParam("parent") String parent, @QueryParam("type") String type);
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public List<ComponentRepresentation> query(@QueryParam("parent") String parent,
|
||||
@QueryParam("type") String type,
|
||||
@QueryParam("name") String name);
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
Response add(ComponentRepresentation rep);
|
||||
|
|
|
@ -1030,6 +1030,7 @@ public class RealmAdapter implements RealmModel, JpaModel<RealmEntity> {
|
|||
for (IdentityProviderEntity entity : realm.getIdentityProviders()) {
|
||||
if (entity.getAlias().equals(alias)) {
|
||||
|
||||
IdentityProviderModel model = entityToModel(entity);
|
||||
em.remove(entity);
|
||||
em.flush();
|
||||
|
||||
|
@ -1042,7 +1043,7 @@ public class RealmAdapter implements RealmModel, JpaModel<RealmEntity> {
|
|||
|
||||
@Override
|
||||
public IdentityProviderModel getRemovedIdentityProvider() {
|
||||
return entityToModel(entity);
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -840,6 +840,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
|||
public void removeIdentityProviderByAlias(String alias) {
|
||||
for (IdentityProviderEntity entity : realm.getIdentityProviders()) {
|
||||
if (entity.getAlias().equals(alias)) {
|
||||
IdentityProviderModel model = entityToModel(entity);
|
||||
realm.getIdentityProviders().remove(entity);
|
||||
updateRealm();
|
||||
|
||||
|
@ -852,7 +853,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
|||
|
||||
@Override
|
||||
public IdentityProviderModel getRemovedIdentityProvider() {
|
||||
return entityToModel(entity);
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -100,7 +100,9 @@ public class ComponentResource {
|
|||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@NoCache
|
||||
public List<ComponentRepresentation> getComponents(@QueryParam("parent") String parent, @QueryParam("type") String type) {
|
||||
public List<ComponentRepresentation> getComponents(@QueryParam("parent") String parent,
|
||||
@QueryParam("type") String type,
|
||||
@QueryParam("name") String name) {
|
||||
auth.requireView();
|
||||
List<ComponentModel> components = Collections.EMPTY_LIST;
|
||||
if (parent == null && type == null) {
|
||||
|
@ -115,6 +117,7 @@ public class ComponentResource {
|
|||
}
|
||||
List<ComponentRepresentation> reps = new LinkedList<>();
|
||||
for (ComponentModel component : components) {
|
||||
if (name != null && !name.equals(component.getName())) continue;
|
||||
ComponentRepresentation rep = ModelToRepresentation.toRepresentation(session, component, false);
|
||||
reps.add(rep);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue