Problem/Motivation

Project Browser supports an undocumented allowed_projects configuration option, which is supposed to be a configurable filter of which projects a particular source can show. We should outright remove it before stable.

Why?

  • It was added to support Drupal CMS at an earlier stage of development and was not well thought-out. At the time, individual sources were not configurable.
  • The intended behavior was only ever implemented by the recipes source. The config object theoretically will filter for any source, but in practice this does not happen and is not supported. So it's inconsistent.
  • This can be replaced by per-source configuration options if desired.
  • It's fully superseded by the new recommended source, which is a much more robust and sensible way to only show a specific set of projects.

Proposed resolution

Completely remove the config option in favor of the recommended source, which is functionally an allow-list unto itself.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

phenaproxima’s picture

Issue tags: -Needs update path
phenaproxima’s picture

Issue tags: +backport

Yeah, this is gonna need a backport.

phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

Status: Active » Needs review
Issue tags: -Needs update path tests
phenaproxima’s picture

Assigned: Unassigned » tim.plunkett

Assigning to @tim.plunkett for review, commit, and backport. I think this change will make a lot of sense to him and he'll have a clear sense about whether the update path is sound.

phenaproxima’s picture

Title: Remove the `allowed_projects` configuration option » [PP-1] Remove the `allowed_projects` configuration option
Assigned: tim.plunkett » Unassigned
Status: Needs review » Postponed
Related issues: +#3305614: Allow a module to be blocked from display on Project Browser

Decided to postpone this on https://www.drupal.org/project/project_browser/issues/3305614, which I think would be a good place to add more generalized support for allow/deny lists in sources.

phenaproxima’s picture

Title: [PP-1] Remove the `allowed_projects` configuration option » Remove the `allowed_projects` configuration option
Status: Postponed » Needs review

After thinking about how this would relate to #3305614: Allow a module to be blocked from display on Project Browser, I decided to change direction here.

Since it makes no logical sense to have both an allow list and a deny list operating on the same set of projects, I think what makes sense here is:

phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

I can, however, see the use case for being able to filter another source through an allow-list. What I think might make sense here -- and would probably need to be a blocker for this issue -- is a whole new source, called allow_list or similar, which decorates another source and filters its results through a configured allow-list. This wouldn't be too hard to do, and it would allow great flexibility for people who want to show "just some of the results from the recipes source", without needing to fully duplicate the information by using recommended.

phenaproxima’s picture

I've been thinking about this and here's what I propose.

There are two things we'd like to allow people to do:

  1. Configure a source to hide a certain subset of its projects.
  2. Find a way to wrap around a source and only show a subset of its projects.

As these are logically two different things, I think we should implement them as separate features.

The first thing is a reject list. We should implement a hide_list configuration option in ProjectBrowserSourceBase and respect it by default in createResultsPage(). This allows site admins to specifically hide certain things from users all the time (a perfect use case for this would be hiding CTools, a module which should almost never be visible to Project Browser's target audience).

The second thing is an allow list. This should probably be a totally new source, maybe called subset, which could be a decorator that takes three configuration options: decorated_id (the plugin ID to decorate), decorated_options (configuration options to pass to the decorated plugin), and query (the query array to pass to the decorated plugin, so as to guarantee that it only shows the stuff you want).

chrisfromredfin’s picture

I've tested !849 manually and can verify it doesn't interfere with any base functionality of PB. Will leave Tim to provide code review, if this is the path forward - seems clear it is from the IS but not from a re-read through the comments.

chrisfromredfin’s picture

Status: Needs review » Patch (to be ported)

Working on 2.1.x but has an issue in 2.0.x

phenaproxima’s picture

Status: Patch (to be ported) » Needs review

chrisfromredfin’s picture

Status: Needs review » Fixed

aaaaand scene.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.