<context:component-scan
base-package="org.apache.archiva.rest.services"/>
+ <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
+ <property name="mapper" ref="redbackJacksonMapper"/>
+ </bean>
+
+ <bean id="redbackJacksonMapper" class="org.codehaus.jackson.map.ObjectMapper">
+ </bean>
<jaxrs:server id="archivaServices" address="/archivaServices">
<jaxrs:providers>
- <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
+ <ref bean="jsonProvider"/>
<ref bean="authenticationInterceptor#rest"/>
<ref bean="permissionInterceptor#rest"/>
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<jaxrs:server id="archivaUiServices" address="/archivaUiServices">
<jaxrs:providers>
+ <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
<ref bean="authenticationInterceptor#rest"/>
<ref bean="permissionInterceptor#rest"/>
<ref bean="archivaRestServiceExceptionMapper"/>
buildLoadJsUrl=function(srcScript){
return srcScript+"?"+appendArchivaVersion();
}
+
+$.ajaxSetup({
+ dataType: 'json'
+});
+
$.ajax(
{
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo",
dataType: 'json',
success:function(data){
- window.archivaDevMode=data.applicationRuntimeInfo.devMode;
- window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog;
- window.archivaRuntimeInfo=data.applicationRuntimeInfo;
+ window.archivaDevMode=data.devMode;
+ window.archivaJavascriptLog=data.javascriptLog;
+ window.archivaRuntimeInfo=data;
require.config({
baseUrl: "js/"
});
$.ajax({
url: url,
success: function(data){
- var mappedOperations = $.map(data.operation, function(item) {
+ var mappedOperations = $.map(data, function(item) {
return mapOperation(item);
});
window.redbackModel.operatioNames = $.map(mappedOperations, function(item){
type: "GET",
dataType: 'json',
success: function(data) {
- var adminExists = JSON.parse(data);
+ var adminExists = data;
if (adminExists == false) {
$("#create-admin-link").show();
$("#login-link").hide();
$.ajax("restServices/redbackServices/loginService/isLogged", {
type: "GET",
success: function(data) {
- userLogged = JSON.parse(data);
+ userLogged = data;
if (successFn){
successFn(userLogged == false ? null : jQuery.parseJSON($.cookie('redback_login')));
}
type: "POST",
dataType: 'json',
contentType: 'application/json',
- data: "{\"role\": " + ko.toJSON(self)+"}",
+ data: ko.toJSON(self),
success: function(data) {
clearUserMessages();
displaySuccessMessage($.i18n.prop("role.users.updated",this.name));
type: "GET",
dataType: 'json',
success: function(data) {
- var mappedRole = mapRole(data.role);
+ var mappedRole = mapRole(data);
role.parentRoleNames(mappedRole.parentRoleNames());
role.parentsRolesUsers(mappedRole.parentsRolesUsers());
role.users(mappedRole.users());
type: "GET",
dataType: 'json',
success: function(data) {
- var mappedRoles = $.map(data.role, function(item) {
+ var mappedRoles = $.map(data, function(item) {
return mapRole(item);
});
var rolesViewModel = new RolesViewModel();
activateRoleUsersEditTab()
}
saveRoleDescription=function(){
- $.log("saveRoleDescription:"+currentRole.description());
currentRole.updateDescription();
}
saveUsers=function(){
}
var currentUser = this;
$.ajax("restServices/redbackServices/userService/createUser", {
- data: "{\"user\": " + ko.toJSON(this)+"}",
+ data: ko.toJSON(this),
contentType: 'application/json',
type: "POST",
dataType: 'json',
success: function(result) {
- var created = JSON.parse(result);
+ var created = result;
if (created == true) {
displaySuccessMessage( $.i18n.prop("user.created",currentUser.username()));
if (successFnCallback){
}
var currentAdminUser = this;
$.ajax("restServices/redbackServices/userService/createAdminUser", {
- data: "{\"user\": " + ko.toJSON(this)+"}",
+ data: ko.toJSON(this),
contentType: 'application/json',
type: "POST",
dataType: 'json',
success: function(result) {
- var created = JSON.parse(result);
+ var created = result;
if (created == true) {
displaySuccessMessage( $.i18n.prop("user.admin.created"));
var onSuccessCall=function(){
this.update=function(){
var currentUser = this;
$.ajax("restServices/redbackServices/userService/updateUser", {
- data: "{\"user\": " + ko.toJSON(this)+"}",
+ data: ko.toJSON(this),
contentType: 'application/json',
type: "POST",
dataType: 'json',
success: function(result) {
- var updated = JSON.parse(result);
+ var updated = result;
if (updated == true) {
clearUserMessages();
displaySuccessMessage($.i18n.prop("user.updated",currentUser.username()));
var curUser = this;
clearUserMessages();
$.ajax("restServices/redbackServices/roleManagementService/updateUserRoles", {
- data: "{\"user\": " + ko.toJSON(this)+"}",
+ data: ko.toJSON(this),
contentType: 'application/json',
type: "POST",
dataType: 'json',
*/
AdminUserViewModel=function() {
this.user = new User("admin","","", "the administrator");
+ var self=this;
+ saveUser=function(){
+ if(! $("#user-create" ).valid() ) {
+ return;
+ }
+ self.user.createAdmin();
+ }
}
/**
if (result == null) {
logged = false;
} else {
- if (result.user) {
+ if (result.username) {
logged = true;
}
}
if (logged == true) {
- var user = mapUser(result.user);
+ var user = mapUser(result);
if (user.passwordChangeRequired()==true){
changePasswordBox(true,false,user);
return;
editUserDetails=function(user){
$("#modal-user-edit-err-message").html("");
$.ajax("restServices/redbackServices/userService/updateMe", {
- data: "{\"user\": " + ko.toJSON(user)+"}",
+ data: ko.toJSON(user),
contentType: 'application/json',
type: "POST",
dataType: 'json',
success: function(result) {
- var created = JSON.parse(result);
+ var created = result;
// FIXME i18n
if (created == true) {
displaySuccessMessage( $.i18n.prop("user.details.updated"));
url: url,
success: function(result){
$.log("changePassword#success result:"+result);
- var user = mapUser(result.user);
+ var user = mapUser(result);
if (user) {
window.modalChangePasswordBox.modal('hide');
$.log("changePassword#sucess,registration:"+registration);
type: "GET",
dataType: 'json',
success: function(data) {
- var mappedRoles = $.map(data.role, function(item) {
+ var mappedRoles = $.map(data, function(item) {
return item.name;
});
user.assignedRoles = ko.observableArray(mappedRoles);
type: "GET",
dataType: 'json',
success: function(data) {
- var mappedApplicationRoles = $.map(data.applicationRole, function(item) {
+ var mappedApplicationRoles = $.map(data, function(item) {
return mapApplicationRoles(item);
});
viewModel.applicationRoles=ko.observableArray(mappedApplicationRoles);
type: "GET",
dataType: 'json',
success: function(data) {
- var mappedUsers = $.map(data.user, function(item) {
+ var mappedUsers = $.map(data, function(item) {
return mapUser(item);
});
var usersViewModel = new UsersViewModel();