

def has_site_permission(user):
    '\n    Checks if a staff user has staff-level access for the current site.\n    The actual permission lookup occurs in ``SitePermissionMiddleware``\n    which then marks the request with the ``has_site_permission`` flag,\n    so that we only query the db once per request, so this function\n    serves as the entry point for everything else to check access. We\n    also fall back to an ``is_staff`` check if the middleware is not\n    installed, to ease migration.\n    '
    mw = 'mezzanine.core.middleware.SitePermissionMiddleware'
    if (mw not in settings.MIDDLEWARE_CLASSES):
        from warnings import warn
        warn((mw + ' missing from settings.MIDDLEWARE_CLASSES - per sitepermissions not applied'))
        return (user.is_staff and mw.is_active)
    return getattr(user, 'has_site_permission', False)

dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/utils/sites.py has_site_permission/VarMisuse@48/264 `user`->`mw`