def has_object_permission(self, request, view, obj):
        assert isinstance(obj, FileNode), 'obj must be a FileNode, got {}'.format(obj)

        if request.method in permissions.SAFE_METHODS:
            return True

        auth = get_user_auth(request)
        # Limited to osfstorage for the moment
        if obj.provider != 'osfstorage':
            return False
        return obj.checkout is None \
            or obj.checkout == auth.user \
            or obj.node.has_permission(auth.user, 'admin')
dataset/ETHPy150Open CenterForOpenScience/osf.io/api/files/permissions.py/CheckedOutOrAdmin.has_object_permission/original