summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b6a5819)
Change-Id: I43b5bbe3aa9b615c40ef72c9faa9e4fd7ffd724f
Signed-off-by: Eduardo Sousa <eduardo.sousa@canonical.com>
"""
projects = self.auth.get_project_list()
current_project = [project for project in projects
"""
projects = self.auth.get_project_list()
current_project = [project for project in projects
- if project["name"] == session["project_id"]][0]
+ if project["name"] in session["project_id"]][0]
if _id == current_project["_id"]:
raise EngineException("You cannot delete your own project", http_code=HTTPStatus.CONFLICT)
if _id == current_project["_id"]:
raise EngineException("You cannot delete your own project", http_code=HTTPStatus.CONFLICT)
for role_def in role_definitions.keys():
if role_def in ignore_fields:
continue
for role_def in role_definitions.keys():
if role_def in ignore_fields:
continue
if isinstance(role_definitions[role_def], bool):
continue
else:
raise ValidationError("Operation authorization \".\" should be True/False.")
if isinstance(role_definitions[role_def], bool):
continue
else:
raise ValidationError("Operation authorization \".\" should be True/False.")
- if role_def[-1] == ".":
+ if role_def[-1] == ":":
raise ValidationError("Operation cannot end with \".\"")
role_def_matches = [op for op in operations if op.startswith(role_def)]
raise ValidationError("Operation cannot end with \".\"")
role_def_matches = [op for op in operations if op.startswith(role_def)]
"""
roles = self.auth.get_role_list()
system_admin_role = [role for role in roles
"""
roles = self.auth.get_role_list()
system_admin_role = [role for role in roles
- if roles["name"] == "system_admin"][0]
+ if role["name"] == "system_admin"][0]
if _id == system_admin_role["_id"]:
raise EngineException("You cannot edit system_admin role", http_code=HTTPStatus.FORBIDDEN)
if _id == system_admin_role["_id"]:
raise EngineException("You cannot edit system_admin role", http_code=HTTPStatus.FORBIDDEN)
"<ID>": {"METHODS": ("GET", "POST", "DELETE", "PATCH", "PUT")}
},
"projects": {"METHODS": ("GET", "POST"),
"<ID>": {"METHODS": ("GET", "POST", "DELETE", "PATCH", "PUT")}
},
"projects": {"METHODS": ("GET", "POST"),
- # Added PUT to allow Project Name modification
"<ID>": {"METHODS": ("GET", "DELETE", "PUT")}
},
"roles": {"METHODS": ("GET", "POST"),
"<ID>": {"METHODS": ("GET", "DELETE", "PUT")}
},
"roles": {"METHODS": ("GET", "POST"),
"type": "object",
"properties": {
"name": shortname_schema,
"type": "object",
"properties": {
"name": shortname_schema,
+ "required": ["name", "root"],
"additionalProperties": True
}
roles_edit_schema = {
"additionalProperties": True
}
roles_edit_schema = {
"title": "Roles edit schema for administrators",
"type": "object",
"properties": {
"title": "Roles edit schema for administrators",
"type": "object",
"properties": {
- "_id": id_schema,
- "name": shortname_schema,
- "required": ["_id", "name"],
"additionalProperties": True,
"minProperties": 1
}
"additionalProperties": True,
"minProperties": 1
}