import org.apache.archiva.admin.model.beans.NetworkConfiguration;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
+import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.archiva.redback.authorization.RedbackAuthorization;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@Path( "getOrganisationInformation" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noPermission = true, noRestriction = true)
+ @RedbackAuthorization( noPermission = true, noRestriction = true )
OrganisationInformation getOrganisationInformation()
throws ArchivaRestServiceException;
void setUiConfiguration( UiConfiguration uiConfiguration )
throws ArchivaRestServiceException;
+ @Path( "applicationUrl" )
+ @GET
+ @Produces( MediaType.TEXT_PLAIN )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ * @since 1.4-M3
+ */
+ String getApplicationUrl()
+ throws ArchivaRestServiceException;
+
@Path( "getNetworkConfiguration" )
@GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
NetworkConfiguration getNetworkConfiguration()
throws ArchivaRestServiceException;
//$("#modal-register").focus();
}
+ UserRegistrationRequest=function(user,applicationUrl){
+ this.user=user;
+ this.applicationUrl=applicationUrl;
+ }
+
/**
* validate the register form and call REST service
*/
register=function(){
- $.log("register.js#register");
+
+ $.log("redback.js#register");
var valid = $("#user-register-form").valid();
if (!valid) {
return;
$('#modal-register-footer').append(smallSpinnerImg());
- var user = {};
- user.username = $("#user-register-form-username").val();
- user.fullName = $("#user-register-form-fullname").val();
- user.email = $("#user-register-form-email").val();
- jQuery.ajax({
- url: 'restServices/redbackServices/userService/registerUser',
- data: JSON.stringify(user),
- type: 'POST',
- contentType: "application/json",
- success: function(result){
- var registered = false;
- if (result == "-1") {
- registered = false;
- } else {
- registered = true;
- }
-
- if (registered == true) {
- window.modalRegisterWindow.modal('hide');
- $("#register-link").hide();
- // FIXME i18n
- displaySuccessMessage("registered your key has been sent");
+ $.ajax({
+ url: "restServices/archivaServices/archivaAdministrationService/applicationUrl",
+ type: "GET",
+ dataType: 'text',
+ success: function(data){
+ $.log("applicationUrl ok:"+data);
+
+ var user = {
+ username: $("#user-register-form-username").val(),
+ fullName: $("#user-register-form-fullname").val(),
+ email: $("#user-register-form-email").val()
+ };
+
+ var userRegistrationRequest=new UserRegistrationRequest(user,data);
+ $.ajax({
+ url: 'restServices/redbackServices/userService/registerUser',
+ data: JSON.stringify(userRegistrationRequest),
+ type: 'POST',
+ contentType: "application/json",
+ success: function(result){
+ var registered = false;
+ if (result == "-1") {
+ registered = false;
+ } else {
+ registered = true;
+ }
+
+ if (registered == true) {
+ window.modalRegisterWindow.modal('hide');
+ $("#register-link").hide();
+ // FIXME i18n
+ displaySuccessMessage("registered your key has been sent");
+ }
+ },
+ complete: function(){
+ $("#modal-register-ok").removeAttr("disabled");
+ removeSmallSpinnerImg();
+ },
+ error: function(result) {
+ var obj = jQuery.parseJSON(result.responseText);
+ displayRedbackError(obj);
+ window.modalRegisterWindow.modal('hide');
+ }
+ });
}
- },
- complete: function(){
- $("#modal-register-ok").removeAttr("disabled");
- removeSmallSpinnerImg();
- },
- error: function(result) {
- var obj = jQuery.parseJSON(result.responseText);
- displayRedbackError(obj);
- window.modalRegisterWindow.modal('hide');
- }
- })
+ });
}