Ensure that user input for groups is unique on API object creation

refs #4732
This commit is contained in:
Michael Friedrich 2018-05-09 17:18:22 +02:00
parent 88d99094bf
commit f070d2136a
1 changed files with 8 additions and 0 deletions

View File

@ -71,6 +71,14 @@ bool CreateObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
}
}
/* Sanity checks for unique groups array. */
if (attrs->Contains("groups")) {
Array::Ptr groups = attrs->Get("groups");
if (groups)
attrs->Set("groups", groups->Unique());
}
Dictionary::Ptr result1 = new Dictionary();
String status;
Array::Ptr errors = new Array();