class ProjectContributorsListServiceImpl implements ContributorsListService {

    @Override
    public Promise<Boolean> canEditContributors(final List<Contributor> contributors,
                                                final ContributorType type) {
        return projectController.canUpdateProject(libraryPlaces.getActiveWorkspace()).then(canUpdateProject -> {
            if (canUpdateProject) {
                return promises.resolve(true);
            }

            final Optional<Contributor> contributor = contributors.stream().filter(c -> c.getUsername().equals(sessionInfo.getIdentity().getIdentifier())).findFirst();
            if (contributor.isPresent()) {
                final ContributorType userContributorType = contributor.get().getType();
                return promises.resolve(contributorsSecurityUtils.canUserEditContributorOfType(userContributorType,
                                                                                               type));
            }

            return promises.resolve(false);
        });
    }

    @Inject public  ProjectContributorsListServiceImpl(final LibraryPlaces libraryPlaces,
                                              final Caller<RepositoryService> repositoryService,
                                              final SpaceContributorsListServiceImpl spaceContributorsListService,
                                              final SessionInfo sessionInfo,
                                              final ProjectController projectController,
                                              final ContributorsSecurityUtils contributorsSecurityUtils,
                                              final Promises promises);

}