var currentUser = this;
openDialogConfirm(function(){
- $.ajax("restServices/redbackServices/userService/deleteUser/"+currentUser.username(), {
+ $.ajax("restServices/redbackServices/userService/deleteUser/"+encodeURIComponent(currentUser.username()), {
type: "GET",
dataType: 'json',
success: function(data) {
});
}
- this.i18n = $.i18n.prop;
+ this.lock=function(){
+ this.locked(true);
+ var curUser = this;
+ clearUserMessages();
+ $.ajax("restServices/redbackServices/userService/lockUser/"+encodeURIComponent(curUser.username()), {
+ type: "GET",
+ success: function(result) {
+ displaySuccessMessage($.i18n.prop("user.locked",curUser.username()));
+ },
+ error: function(result) {
+ var obj = jQuery.parseJSON(result.responseText);
+ displayRedbackError(obj);
+ }
+ });
+ }
+
+ this.unlock=function(){
+ this.locked(false);
+ var curUser = this;
+ clearUserMessages();
+ $.ajax("restServices/redbackServices/userService/unlockUser/"+encodeURIComponent(curUser.username()), {
+ type: "GET",
+ success: function(result) {
+ displaySuccessMessage($.i18n.prop("user.unlocked",curUser.username()));
+ },
+ error: function(result) {
+ var obj = jQuery.parseJSON(result.responseText);
+ displayRedbackError(obj);
+ }
+ });
+ }
+
+ // value is boolean
+ this.changePasswordChangeRequired=function(value){
+ this.passwordChangeRequired(value);
+ var curUser = this;
+ var url = "restServices/redbackServices/userService/passwordChangeRequired/"+encodeURIComponent(curUser.username());
+ if (value==false){
+ url = "restServices/redbackServices/userService/passwordChangeNotRequired/"+encodeURIComponent(curUser.username());
+ }
+ $.ajax(url, {
+ type: "GET",
+ success: function(result) {
+ displaySuccessMessage($.i18n.prop("user.passwordChangeRequired.updated",curUser.username()));
+ },
+ error: function(result) {
+ var obj = jQuery.parseJSON(result.responseText);
+ displayRedbackError(obj);
+ }
+ });
+ };
+
+ this.i18n = $.i18n.prop;
}
/**
this.lock = function(user){
clearUserMessages();
- user.locked(true);
- window.redbackModel.createUser=false;
- user.save();
+ user.lock();
}
this.unlock = function(user){
clearUserMessages();
- user.locked(false);
- window.redbackModel.createUser=false;
- user.save();
+ user.unlock();
}
this.passwordChangeRequire = function(user,forceChangedPassword){
clearUserMessages();
- user.passwordChangeRequired(forceChangedPassword);
- window.redbackModel.createUser=false;
- user.save();
+ user.changePasswordChangeRequired(forceChangedPassword);
}
this.sortByName = function() {