From f5163f5f837a787f7f91bc1d60d85f19c91ffcf6 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Tue, 27 Jan 2015 14:22:32 +0800 Subject: [PATCH] Remove db layer hard-code permission checks for v2.1 agents This patch removes db layer hard-code permission checks for v2.1 agents, also add back-compatible check for v2 agents. This patch also correct the unittest. For v2.1 unittest, the unittest should run with normal user context that ensure the code is un-winded by any other permission checks except the policy enforcement. Partially implements bp v3-api-policy Change-Id: If3ff67c954f2a1338ceb5a71b66b0405a4266ffd --- nova/db/sqlalchemy/api.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 006dde33b..f0986ae0f 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -4925,7 +4925,6 @@ def instance_system_metadata_update(context, instance_uuid, metadata, delete): #################### -@require_admin_context def agent_build_create(context, values): agent_build_ref = models.AgentBuild() agent_build_ref.update(values) @@ -4937,7 +4936,6 @@ def agent_build_create(context, values): return agent_build_ref -@require_admin_context def agent_build_get_by_triple(context, hypervisor, os, architecture): return model_query(context, models.AgentBuild, read_deleted="no").\ filter_by(hypervisor=hypervisor).\ @@ -4946,7 +4944,6 @@ def agent_build_get_by_triple(context, hypervisor, os, architecture): first() -@require_admin_context def agent_build_get_all(context, hypervisor=None): if hypervisor: return model_query(context, models.AgentBuild, read_deleted="no").\ @@ -4957,7 +4954,6 @@ def agent_build_get_all(context, hypervisor=None): all() -@require_admin_context def agent_build_destroy(context, agent_build_id): rows_affected = model_query(context, models.AgentBuild).filter_by( id=agent_build_id).soft_delete() @@ -4965,7 +4961,6 @@ def agent_build_destroy(context, agent_build_id): raise exception.AgentBuildNotFound(id=agent_build_id) -@require_admin_context def agent_build_update(context, agent_build_id, values): rows_affected = model_query(context, models.AgentBuild).\ filter_by(id=agent_build_id).\