From f070d2136a6ded1dbf08b0ba424f79eb6b29a8f8 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 9 May 2018 17:18:22 +0200 Subject: [PATCH] Ensure that user input for groups is unique on API object creation refs #4732 --- lib/remote/createobjecthandler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/remote/createobjecthandler.cpp b/lib/remote/createobjecthandler.cpp index e3646b3f3..a365ed664 100644 --- a/lib/remote/createobjecthandler.cpp +++ b/lib/remote/createobjecthandler.cpp @@ -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();