'Checks if show is allowed in the current hierarchy.
With hierarchical projects, users are allowed to perform a quota show
operation if they have the cloud admin role or if they belong to at
least one of the following projects: the target project, its immediate
parent project, or the root project of its hierarchy.
:param context_project: The project in which the user
is scoped to.
:param target_project: The project in which the user wants
to perform a show operation.'

def _authorize_show(self, context_project, target_project):

    if context_project.is_admin_project:
        return
    if target_project.parent_id:
        if (target_project.id != context_project.id):
            if (not self._is_descendant(target_project.id, context_project.subtree)):
                msg = _('Show    operations    can    only    be    made    to    projects    in    the    same    hierarchy    of    the    project    in    which    users    are    scoped    to.')
                raise webob.exc.HTTPForbidden(explanation=msg)
            if (context_project.id != target_project.parent_id):
                if context_project.parent_id:
                    msg = _('Only    users    with    token    scoped    to    immediate    parents    or    root    projects    are    allowed    to    see    its    children    quotas.')
                    raise webob.exc.HTTPForbidden(explanation=msg)
    elif context_project.parent_id:
        msg = _('An    user    with    a    token    scoped    to    a    subproject    is    not    allowed    to    see    the    quota    of    its    parents.')
        raise webob.exc.HTTPForbidden(explanation=msg)
