class ProjectController {

    public Promise<List<Branch>> getUpdatableBranches(final WorkspaceProject project) {
        if (project.getMainModule() == null) {
            return promises.resolve(Collections.emptyList());
        }

        if (authorizationManager.authorize(project.getRepository(),
                                           RepositoryAction.UPDATE,
                                           user)) {
            return promises.resolve(new ArrayList<>(project.getRepository().getBranches()));
        }

        return getBranchesWithPermission(project, RolePermissions::canWrite);
    }

    @Inject public  ProjectController(final AuthorizationManager authorizationManager,
                             final User user,
                             final Caller<ProjectPermissionsService> projectPermissionsService,
                             final Promises promises);

}