[KEYCLOAK-4901] - New policy mgmt rest api should return specific representations for a policy type

This commit is contained in:
Pedro Igor 2017-10-26 15:26:40 -02:00
parent a70cab502c
commit 57d3c44bb7
3 changed files with 9 additions and 2 deletions

View file

@ -22,6 +22,8 @@ import java.util.Map;
import org.keycloak.authorization.AuthorizationProvider; import org.keycloak.authorization.AuthorizationProvider;
import org.keycloak.authorization.model.Policy; import org.keycloak.authorization.model.Policy;
import org.keycloak.authorization.model.ResourceServer; import org.keycloak.authorization.model.ResourceServer;
import org.keycloak.models.utils.ModelToRepresentation;
import org.keycloak.representations.idm.authorization.AbstractPolicyRepresentation;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator; import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
import org.keycloak.services.resources.admin.AdminEventBuilder; import org.keycloak.services.resources.admin.AdminEventBuilder;
@ -56,4 +58,9 @@ public class PermissionService extends PolicyService {
filters.put("permission", new String[] {Boolean.TRUE.toString()}); filters.put("permission", new String[] {Boolean.TRUE.toString()});
return super.doSearch(firstResult, maxResult, filters); return super.doSearch(firstResult, maxResult, filters);
} }
@Override
protected AbstractPolicyRepresentation toRepresentation(Policy policy, AuthorizationProvider authorization) {
return ModelToRepresentation.toRepresentation(policy, authorization, false, false);
}
} }

View file

@ -62,6 +62,6 @@ public class PolicyTypeResourceService extends PolicyResourceService {
@Override @Override
protected AbstractPolicyRepresentation toRepresentation(Policy policy, AuthorizationProvider authorization) { protected AbstractPolicyRepresentation toRepresentation(Policy policy, AuthorizationProvider authorization) {
return ModelToRepresentation.toRepresentation(policy, authorization); return ModelToRepresentation.toRepresentation(policy, authorization, false, false);
} }
} }

View file

@ -88,7 +88,7 @@ public class PolicyTypeService extends PolicyService {
@Override @Override
protected AbstractPolicyRepresentation toRepresentation(Policy policy, AuthorizationProvider authorization) { protected AbstractPolicyRepresentation toRepresentation(Policy policy, AuthorizationProvider authorization) {
return ModelToRepresentation.toRepresentation(policy, authorization); return ModelToRepresentation.toRepresentation(policy, authorization, false, false);
} }
@Override @Override