

def get_can_use_permission(request, permission, permittee, target_obj_or_class, redirect_to=None):
    "Get the 'can_use_aggregate' permission.\n    \n    For project, slice, or user permittees, call the corresponding\n    add_to_* method of the target aggregate.\n    "
    assert isinstance(target_obj_or_class, Aggregate)
    assert (isinstance(permittee, User) or isinstance(permittee, Project) or isinstance(permittee, Slice))
    assert (permission.name == 'can_use_aggregate')
    aggregate = target_obj_or_class
    try:
        next = request.session['breadcrumbs'][(- 1)][1]
    except IndexError:
        next = (redirect_to or reverse('home'))
    if isinstance(permittee, Project):
        return HttpResponseRedirect(request.as_leaf_class().add_to_project(permittee, next))
    elif isinstance(permittee, Slice):
        return HttpResponseRedirect(aggregate.as_leaf_class().add_to_slice(permittee, next))
    else:
        return HttpResponseRedirect(aggregate.as_leaf_class().add_to_user(permittee, next))

dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/aggregate/views.py get_can_use_permission/VarMisuse@120/235 `aggregate`->`request`