User groups can now be created/saved
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user