class NotLocalFolderAndResourceArgumentVoter extends BasicObjectPermissionArgumentVoter {

    @Override
    protected boolean isPermitted(Authentication authentication, ObjectPermission objectPermission, Object object) {
        InternalURI internalURI = new InternalURIDefinition(objectPermission.getURI());
        return !(repositoryService.isLocalFolder(null, internalURI.getPath()) ||
                isLocalResource(internalURI));
    }

}