projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix project_user role permissions
[osm/NBI.git]
/
osm_nbi
/
validation.py
diff --git
a/osm_nbi/validation.py
b/osm_nbi/validation.py
index
a081ffa
..
6e43be5
100644
(file)
--- a/
osm_nbi/validation.py
+++ b/
osm_nbi/validation.py
@@
-631,6
+631,7
@@
user_edit_schema = {
}
# PROJECTS
}
# PROJECTS
+topics_with_quota = ["vnfds", "nsds", "nsts", "pdus", "nsrs", "nsis", "vim_accounts", "wim_accounts", "sdns"]
project_new_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "New project schema for administrators",
project_new_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "New project schema for administrators",
@@
-638,6
+639,11
@@
project_new_schema = {
"properties": {
"name": shortname_schema,
"admin": bool_schema,
"properties": {
"name": shortname_schema,
"admin": bool_schema,
+ "quotas": {
+ "type": "object",
+ "properties": {topic: integer0_schema for topic in topics_with_quota},
+ "additionalProperties": False
+ },
},
"required": ["name"],
"additionalProperties": False
},
"required": ["name"],
"additionalProperties": False
@@
-649,6
+655,11
@@
project_edit_schema = {
"properties": {
"admin": bool_schema,
"name": shortname_schema, # To allow Project Name modification
"properties": {
"admin": bool_schema,
"name": shortname_schema, # To allow Project Name modification
+ "quotas": {
+ "type": "object",
+ "properties": {topic: {"oneOf": [integer0_schema, null_schema]} for topic in topics_with_quota},
+ "additionalProperties": False
+ },
},
"additionalProperties": False,
"minProperties": 1
},
"additionalProperties": False,
"minProperties": 1
@@
-661,20
+672,34
@@
roles_new_schema = {
"type": "object",
"properties": {
"name": shortname_schema,
"type": "object",
"properties": {
"name": shortname_schema,
- "root": bool_schema,
+ "permissions": {
+ "type": "object",
+ "patternProperties": {
+ ".": bool_schema,
+ },
+ # "minProperties": 1,
+ }
},
},
- "required": ["name"
, "root"
],
- "additionalProperties":
Tru
e
+ "required": ["name"],
+ "additionalProperties":
Fals
e
}
roles_edit_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Roles edit schema for administrators",
"type": "object",
"properties": {
}
roles_edit_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Roles edit schema for administrators",
"type": "object",
"properties": {
- "root": bool_schema,
+ "name": shortname_schema,
+ "permissions": {
+ "type": "object",
+ "patternProperties": {
+ ".": {
+ "oneOf": [bool_schema, null_schema]
+ }
+ },
+ # "minProperties": 1,
+ }
},
},
- "required": ["root"],
- "additionalProperties": True,
+ "additionalProperties": False,
"minProperties": 1
}
"minProperties": 1
}
@@
-793,5
+818,5
@@
def is_valid_uuid(x):
try:
if UUID(x):
return True
try:
if UUID(x):
return True
- except (TypeError, ValueError):
+ except (TypeError, ValueError
, AttributeError
):
return False
return False