public void delete(int deleteVersion, String user) throws IOException {
		synchronized (fileSystem) {
			validate();
			User userObj = repository.validateWritePrivilege(user);

			if (!userObj.isAdmin()) {
				Version[] versions = databaseItem.getVersions();
				if (deleteVersion == -1) {
					for (Version version : versions) {
						if (!user.equals(version.getUser())) {
							throw new UserAccessException(getName() + " version " +
								version.getVersion() + " owned by " + version.getUser());
						}
					}
				}
				else if (deleteVersion == versions[0].getVersion()) {
					if (!user.equals(versions[0].getUser())) {
						throw new UserAccessException(getName() + " version " + deleteVersion +
							" owned by " + versions[0].getUser());
					}
				}
				else if (deleteVersion == versions[versions.length - 1].getVersion()) {
					if (!user.equals(versions[versions.length - 1].getUser())) {
						throw new UserAccessException(getName() + " version " + deleteVersion +
							" owned by " + versions[versions.length - 1].getUser());
					}
				}
				else {
					throw new IOException("Only the oldest or latest version may be deleted");
				}
			}
			String oldPath = getPathname();
			if (databaseItem == null) {
				// forced removal by repo Admin

			}
			else {
				databaseItem.delete(deleteVersion, user);
			}
			deleted = true;
			repositoryItem = null;
			parent.fileDeleted(this);
			RepositoryFile newRf = parent.getFile(name);
			if (newRf == null) {
				RepositoryManager.log(repository.getName(), oldPath, "file deleted", user);
			}
			parent = null;
		}
	}
Delete oldest or current version of this file/item.
@param deleteVersion oldest or current version, or -1 to remove
all versions.
@param user user who initiated the request
@throws UserAccessException if user is denied ability to delete version(s)
@throws IOException if an IO error occurs
Ghidra/Features/GhidraServer/src/main/java/ghidra/server/store/RepositoryFile.java