class ProjectController {

    public Promise<Boolean> canBuildProject(final WorkspaceProject workspaceProject) {
        if (workspaceProject.getMainModule() == null) {
            return promises.resolve(false);
        }

        if (authorizationManager.authorize(workspaceProject.getRepository(),
                                           RepositoryAction.BUILD,
                                           user)) {
            return promises.resolve(true);
        }

        return checkBranchPermission(workspaceProject,
                                     workspaceProject.getBranch().getName(),
                                     RolePermissions::canWrite);
    }

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

}