class RepositoryPermissionServiceImpl implements RepositoryPermissionService {

	@Override
	public Optional<AccessLevel> canRead(Principal loginUser, Repository project) {
		if (project.getIsPublic()) {
			return Optional.of(AccessLevel.READ);
		}

		if (loginUser == null) {
			return Optional.empty();
		}
		
		return hasPermission(loginUser.getName(), project, AccessLevel.READ);
	}

}