

def _authorize_cross_tenant(self, user_id, user_name, tenant_id, tenant_name, roles, allow_names=True):
    "Check cross-tenant ACLs.\n\n        Match tenant:user, tenant and user could be its id, name or '*'\n\n        :param user_id: The user id from the identity token.\n        :param user_name: The user name from the identity token.\n        :param tenant_id: The tenant ID from the identity token.\n        :param tenant_name: The tenant name from the identity token.\n        :param roles: The given container ACL.\n        :param allow_names: If True then attempt to match tenant and user names\n                            as well as id's.\n\n        :returns: matched string if tenant(name/id/*):user(name/id/*) matches\n                  the given ACL.\n                  None otherwise.\n\n        "
    tenant_match = [tenant_id, '*']
    user_match = [user_id, '*']
    if roles:
        tenant_match = (tenant_match + [tenant_name])
        user_match = (user_match + [user_name])
    for tenant in tenant_match:
        for user in user_match:
            s = ('%s:%s' % (tenant, user))
            if (s in roles):
                return s
    return None

dataset/ETHPy150Open openstack/swift/swift/common/middleware/keystoneauth.py KeystoneAuth._authorize_cross_tenant/VarMisuse@43/320 `allow_names`->`roles`