fix bugs 747 757: fix user-update interface for RBAC+keystone

Change-Id: I2c3a754b7bd68fa801cc930f13762ca2585612a6
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py
index a244ac1..a081ffa 100644
--- a/osm_nbi/validation.py
+++ b/osm_nbi/validation.py
@@ -566,16 +566,35 @@
 }
 
 # USERS
-project_role_mapping = {
-    "title": "",
+project_role_mappings = {
+    "title": "list pf projects/roles",
     "$schema": "http://json-schema.org/draft-04/schema#",
-    "type": "object",
-    "properties": {
-        "project": shortname_schema,
-        "role": shortname_schema
+    "type": "array",
+    "items": {
+        "type": "object",
+        "properties": {
+            "project": shortname_schema,
+            "role": shortname_schema
+        },
+        "required": ["project", "role"],
+        "additionalProperties": False
     },
-    "required": ["project", "role"],
-    "additionalProperties": False
+    "minItems": 1
+}
+project_role_mappings_optional = {
+    "title": "list of projects/roles or projects only",
+    "$schema": "http://json-schema.org/draft-04/schema#",
+    "type": "array",
+    "items": {
+        "type": "object",
+        "properties": {
+            "project": shortname_schema,
+            "role": shortname_schema
+        },
+        "required": ["project"],
+        "additionalProperties": False
+    },
+    "minItems": 1
 }
 user_new_schema = {
     "$schema": "http://json-schema.org/draft-04/schema#",
@@ -585,11 +604,7 @@
         "username": shortname_schema,
         "password": passwd_schema,
         "projects": nameshort_list_schema,
-        "project_role_mappings": {
-            "type": "array",
-            "items": project_role_mapping,
-            "minItems": 1
-        },
+        "project_role_mappings": project_role_mappings,
     },
     "required": ["username", "password"],
     "additionalProperties": False
@@ -607,11 +622,9 @@
                 array_edition_schema
             ]
         },
-        "project_role_mappings": {
-            "type": "array",
-            "items": project_role_mapping,
-            "minItems": 1
-        },
+        "project_role_mappings": project_role_mappings,
+        "add_project_role_mappings": project_role_mappings,
+        "remove_project_role_mappings": project_role_mappings_optional,
     },
     "minProperties": 1,
     "additionalProperties": False