User groups can now be created/saved

This commit is contained in:
Shannon
2017-06-20 15:10:42 +10:00
parent 4e1e2c5332
commit d7e65dd088
10 changed files with 131 additions and 42 deletions

View File

@@ -174,13 +174,13 @@
"Failed to save user");
}
function saveUserGroup(userGroup) {
function saveUserGroup(userGroup, isNew) {
if (!userGroup) {
throw "userGroup not specified";
}
//need to convert the user data into the correctly formatted save data - it is *not* the same and we don't want to over-post
var formattedSaveData = umbDataFormatter.formatUserGroupPostData(userGroup);
var formattedSaveData = umbDataFormatter.formatUserGroupPostData(userGroup, "save" + (isNew ? "New" : ""));
return umbRequestHelper.resourcePromise(
$http.post(

View File

@@ -688,10 +688,15 @@ function umbDataFormatter() {
},
/** formats the display model used to display the user group to the model used to save the user group*/
formatUserGroupPostData: function (displayModel) {
formatUserGroupPostData: function (displayModel, action) {
//create the save model from the display model
var saveModel = _.pick(displayModel, 'id', 'alias', 'name', 'sections', 'users', 'startContentId', 'startMediaId');
//set the action on the save model
saveModel.action = action;
if (!saveModel.id) {
saveModel.id = 0;
}
//make sure the sections are just a string array
var currSections = saveModel.sections;