class SpaceContributorsListServiceImpl implements ContributorsListService {

    @Override
    public Promise<Boolean> canEditContributors(final List<Contributor> contributors,
                                                final ContributorType type) {
        if (organizationalUnitController.canUpdateOrgUnit(libraryPlaces.getActiveSpace())) {
            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  SpaceContributorsListServiceImpl(final LibraryPlaces libraryPlaces,
                                            final Caller<OrganizationalUnitService> organizationalUnitService,
                                            final Event<AfterEditOrganizationalUnitEvent> afterEditOrganizationalUnitEvent,
                                            final Caller<LibraryService> libraryService,
                                            final SessionInfo sessionInfo,
                                            final OrganizationalUnitController organizationalUnitController,
                                            final ContributorsSecurityUtils contributorsSecurityUtils,
                                            final Promises promises);

}