Using project* instead of tenant*

Implements: blueprint remove-tenant

Change-Id: If75f96f7daa6ec38596db302e05148109a256df8
This commit is contained in:
zhangbailin 2022-03-14 16:39:14 +08:00 committed by Brin Zhang
parent 99404c804e
commit d3e26b50da
4 changed files with 8 additions and 8 deletions

View File

@ -57,10 +57,10 @@ class ContextHook(hooks.PecanHook):
The following HTTP request headers are used: The following HTTP request headers are used:
X-User-Id or X-User: X-User-Id or X-User:
Used for context.user. Used for context.user_id.
X-Tenant-Id or X-Tenant: X-Tenant-Id or X-Tenant:
Used for context.tenant. Used for context.project_id.
X-Auth-Token: X-Auth-Token:
Used for context.auth_token. Used for context.auth_token.

View File

@ -76,7 +76,7 @@ def model_query(context, model, *args, **kwargs):
""" """
if kwargs.pop("project_only", False): if kwargs.pop("project_only", False):
kwargs["project_id"] = context.tenant kwargs["project_id"] = context.project_id
with _session_for_read() as session: with _session_for_read() as session:
query = sqlalchemyutils.model_query( query = sqlalchemyutils.model_query(

View File

@ -97,7 +97,7 @@ class QuotaEngine(object):
value will be treated as a number of seconds). value will be treated as a number of seconds).
:param project_id: Specify the project_id if current context :param project_id: Specify the project_id if current context
is admin and admin wants to impact on is admin and admin wants to impact on
common user's tenant. common user's project.
""" """
if not project_id: if not project_id:
project_id = context.project_id project_id = context.project_id
@ -117,7 +117,7 @@ class QuotaEngine(object):
returned by the reserve() method. returned by the reserve() method.
:param project_id: Specify the project_id if current context :param project_id: Specify the project_id if current context
is admin and admin wants to impact on is admin and admin wants to impact on
common user's tenant. common user's project.
""" """
project_id = context.project_id project_id = context.project_id
try: try:
@ -173,7 +173,7 @@ class DbQuotaDriver(object):
returned by the reserve() method. returned by the reserve() method.
:param project_id: Specify the project_id if current context :param project_id: Specify the project_id if current context
is admin and admin wants to impact on is admin and admin wants to impact on
common user's tenant. common user's project.
""" """
try: try:

View File

@ -136,10 +136,10 @@ class BaseApiTest(base.DbTestCase):
headers = { headers = {
'X-User-Name': ct.get("user_name") or "user", 'X-User-Name': ct.get("user_name") or "user",
'X-User-Id': 'X-User-Id':
ct.get("user") or "1d6d686bc2c949ddb685ffb4682e0047", ct.get("user_id") or "1d6d686bc2c949ddb685ffb4682e0047",
'X-Project-Name': ct.get("project_name") or "no_project_name", 'X-Project-Name': ct.get("project_name") or "no_project_name",
'X-Project-Id': 'X-Project-Id':
ct.get("tenant") or "86f64f561b6d4f479655384572727f70", ct.get("project_id") or "86f64f561b6d4f479655384572727f70",
'X-User-Domain-Id': 'X-User-Domain-Id':
ct.get("domain_id") or "bd5eeb7d0fb046daaf694b36f4df5518", ct.get("domain_id") or "bd5eeb7d0fb046daaf694b36f4df5518",
'X-User-Domain-Name': ct.get("domain_name") or "no_domain", 'X-User-Domain-Name': ct.get("domain_name") or "no_domain",