summaryrefslogtreecommitdiffstats
path: root/base/common/src/com
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2013-07-29 12:23:03 -0400
committerAde Lee <alee@redhat.com>2013-07-31 16:57:35 -0400
commitea1d7a70d9fad28a1729d1de4968edafdaeb0889 (patch)
treefc7a0fcaae390c9d3963c08386af50234be65ffa /base/common/src/com
parenta5326958593a84236879c1bf9cc8b54e86ce089f (diff)
Fix various issues with Profile Interface
1. Fixed REST API as per review. 2. Add output for profile-show and profile-find
Diffstat (limited to 'base/common/src/com')
-rw-r--r--base/common/src/com/netscape/certsrv/profile/ProfileDataInfo.java21
-rw-r--r--base/common/src/com/netscape/certsrv/profile/ProfileResource.java12
-rw-r--r--base/common/src/com/netscape/cms/servlet/profile/ProfileService.java11
3 files changed, 32 insertions, 12 deletions
diff --git a/base/common/src/com/netscape/certsrv/profile/ProfileDataInfo.java b/base/common/src/com/netscape/certsrv/profile/ProfileDataInfo.java
index 22062309d..c01d55d16 100644
--- a/base/common/src/com/netscape/certsrv/profile/ProfileDataInfo.java
+++ b/base/common/src/com/netscape/certsrv/profile/ProfileDataInfo.java
@@ -36,6 +36,12 @@ public class ProfileDataInfo {
@XmlElement
protected String profileId;
+ @XmlElement
+ protected String profileName;
+
+ @XmlElement
+ protected String profileDescription;
+
public ProfileDataInfo() {
// required for JAXB (defaults)
}
@@ -65,4 +71,19 @@ public class ProfileDataInfo {
return profileId;
}
+ public String getProfileName() {
+ return profileName;
+ }
+
+ public void setProfileName(String profileName) {
+ this.profileName = profileName;
+ }
+
+ public String getProfileDescription() {
+ return profileDescription;
+ }
+
+ public void setProfileDescription(String profileDescription) {
+ this.profileDescription = profileDescription;
+ }
}
diff --git a/base/common/src/com/netscape/certsrv/profile/ProfileResource.java b/base/common/src/com/netscape/certsrv/profile/ProfileResource.java
index 317215afb..5c733aa59 100644
--- a/base/common/src/com/netscape/certsrv/profile/ProfileResource.java
+++ b/base/common/src/com/netscape/certsrv/profile/ProfileResource.java
@@ -13,41 +13,39 @@ import javax.ws.rs.core.MediaType;
import com.netscape.certsrv.authentication.AuthMethodMapping;
-@Path("")
+@Path("profiles")
public interface ProfileResource {
@GET
- @Path("profiles")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ProfileDataInfos listProfiles();
@GET
- @Path("profiles/{id}")
+ @Path("{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public ProfileData retrieveProfile(@PathParam("id") String id);
@POST
- @Path("admin/profiles")
@AuthMethodMapping("admin")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void createProfile(ProfileData data);
@POST
- @Path("agent/profiles/{id}")
+ @Path("{id}")
@AuthMethodMapping("agent")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void modifyProfileState(@PathParam("id") String id, @QueryParam("action") String action);
@PUT
- @Path("admin/profiles/{id}")
+ @Path("{id}")
@AuthMethodMapping("admin")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void modifyProfile(@PathParam("id") String id, ProfileData data);
@DELETE
- @Path("admin/profiles/{id}")
+ @Path("{id}")
@AuthMethodMapping("admin")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public void deleteProfile(@PathParam("id") String id);
diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java
index e8adc9b2a..734a527d8 100644
--- a/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java
+++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileService.java
@@ -275,13 +275,14 @@ public class ProfileService extends PKIService implements ProfileResource {
ret = new ProfileDataInfo();
ret.setProfileId(profileId);
+ ret.setProfileName(profile.getName(getLocale()));
+ ret.setProfileDescription(profile.getDescription(getLocale()));
UriBuilder profileBuilder = uriInfo.getBaseUriBuilder();
+ URI uri = profileBuilder.path(ProfileResource.class).path("{id}").
+ build(profileId);
- // TODO - fix this once we figure out the auth problem
- //URI uri = profileBuilder.path(ProfileResource.class).path("{id}").
- // build(profileId);
-
+ /*
URI uri = null;
if (visibleOnly) {
uri = profileBuilder.path(ProfileResource.class).path("profiles").path("{id}")
@@ -289,7 +290,7 @@ public class ProfileService extends PKIService implements ProfileResource {
} else {
uri = profileBuilder.path(ProfileResource.class).path("agent").path("profiles")
.path("{id}").build(profileId);
- }
+ }*/
ret.setProfileURL(uri.toString());