diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js index 7d92fd054e210de75a8f1ac4ba448f68f6a9829c..f4415c87c6b5774979f9b8196d037175178add58 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js @@ -290,16 +290,27 @@ function ServerFacade(openbisServer) { this.openbisServer.createReportFromAggregationService(dataStoreCode, "newbrowserapi", parameters, callbackFunction); } - this.createELNUser = function(userId, userPass) { - var _this = this; - _this.createReportFromAggregationService( - profile.getDefaultDataStoreCode(), - { - "method" : "registerUserPassword", - "userId" : userId, - "password" : userPass - }, - function(data){ + this.registerUserPassword = function(userId, userPass, callbackFunction) { + this.createReportFromAggregationService( + profile.getDefaultDataStoreCode(), + { + "method" : "registerUserPassword", + "userId" : userId, + "password" : userPass + }, + function(data){ + if(data.result.rows[0][0].value == "OK") { + callbackFunction(true); + } else { + callbackFunction(false); + } + }); + } + + this.createELNUser = function(userId, userPass) { + var _this = this; + _this.registerUserPassword(userId, userPass, function(isSuccess){ + if(isSuccess) { _this.openbisServer.registerPerson(userId, function(data) { _this.openbisServer.registerSpace(userId, "Space for user " + userId, function(data) { _this.openbisServer.registerPersonSpaceRole(userId, userId, "ADMIN", function(data) { @@ -307,8 +318,10 @@ function ServerFacade(openbisServer) { }); }); }); - }); - } + } + }); + } + // // Configuration Related Functions //