def get_object_context(root):
    """Depth-first discovery of authentication context for an object.

    Walks the ACL graph via ``__acl_bases__`` and merges the ``__acl_context__``
    attributes.

    """

    context = {}
    for obj in iter_object_graph(root, parents_first=True):
        context.update(getattr(obj, '__acl_context__', {}))
    return context
Depth-first discovery of authentication context for an object.

    Walks the ACL graph via ``__acl_bases__`` and merges the ``__acl_context__``
    attributes.