Catalog visibility in Tutor deployed Open edX

I have noticed that the Tutor instance does not change catalog visibility if I change this in Advanced Settings. Neither “about” or “none” works and the platform continuously displays the default “both”.

Anyone with insight into the issue? I only experienced this with Tutor

Log output here at Pastebin: https://pastebin.com/EVNbaTAz

Versions:
tutor, version 3.8.0
overhangio/openedx:3.8.0

1 Like

@ak00001 This is a really good catch. The “course visibility in catalog” setting is not taken into account because the COURSE_CATALOG_VISIBILITY_PERMISSION and COURSE_ABOUT_VISIBILITY_PERMISSION settings are incorrectly set to the legacy default, which is see_exists. Instead, these settings should be:

COURSE_CATALOG_VISIBILITY_PERMISSION = "see_in_catalog"
COURSE_ABOUT_VISIBILITY_PERMISSION = "see_about_page"

As far as I understand, the native Open edX install is also affected by this issue.

Note that changes might not be immediately viewable, because of caching. Also, remember that logged-in staff users will always be able to view all catalog courses, as well as their about pages. Finally, I did not manage to hide courses from the course search (http://0.0.0.0:8000/courses). It appears this does not use the course catalog visibility setting.

This will be fixed in the next release (3.8.1).

1 Like

Thanks @regis.
I was digging in the EdX Discussion forum and found some pointers in this direction as well. I will await the release then. :slight_smile:

Was this issue fixed in (3.8.1) ? Because I am using tutor 3.12.* and after having set the COURSE_CATALOG_VISIBILITY_PERMISSION and COURSE_ABOUT_VISIBILITY_PERMISSION using plugins, I still could access all the courses at {url}/courses .

@deepus Yes, this should now be fixed in 3.8.1+, and you should not need a plugin. Did you remember to modify the visibility of the courses in the advanced settings? @ak00001 can you confirm that the fix worked for you?

I investigated a little and reproduced your problem: it boils down to the fact that /courses is not the catalog, and the courses that are displayed there are unaffected by the visibility settings from the advanced settings. If you’d like to disable this page entirely, then you need to set FEATURES["ENABLE_COURSE_DISCOVERY"] = False in the lms settings. I suggest you create a small plugin to resolve this (and please post it here ;))

2 Likes

sorry my late response here. the first proposed solution was sufficient for us.

A follow up: Does this configuration (ENABLE_COURSE_DISCOVERY=FALSE) affect the Discovery service, or is it a separate thing with the same name?

This setting does not affect the Discovery service, this is an unfortunate naming collision.

1 Like

How shall I create this plugin?
Should I make a yml with the following and enable it ?

name: myplugin
version: 0.1.0
patches:
  common-env-features: |
          "ENABLE_COURSE_DISCOVERY": false

@regis I’m running into this issue too now of wanting to hide courses from Discover New but it not obeying what’s specified in the advanced settings “visibility”. What’s the right way syntactically to make this setting play nice with the other setting I set from another thread? I.e. I put

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "eur",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
  common-env-features: |
   "ENABLE_COURSE_DISCOVERY": false

I also tried with an empty line before common-env-features above. And the below:

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "eur",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
  lms-env: |
   "ENABLE_COURSE_DISCOVERY": false

but I get an error during tutor local quickstart for both. Are those names like “lms-env” and “common-env-features” specific namespaces that I need to look up (if so, where are they listed)? Or are they just arbitrary names the plugin author is selecting to keep things straight for themselves?

@oedx You should learn more about plugins and patches. See this: Plugin API — Tutor documentation
And in particular: Plugin API — Tutor documentation

In a nutshell: patches are blobs of text that are inserted in templates whenever you run tutor config save (or quickstart). To find the list of supported patches, you need to look at the Tutor source code (see the note in the docs above). The “lms-env” patch is included in a json file: tutor/lms.env.json at 6ca863e04c5943002f94a8bbc877494444242bf9 · overhangio/tutor · GitHub
Thus, the “lms-env” patch should be formatted as json. Also, you should not define it twice, otherwise one will override the other.
Please open a new topic if you need further clarifications on the topic of plugins.

The reason I was still posting in this topic is because the subject line is my topic, but it was never fully solved here. Because you suggested he create and post a patching plugin, but never confirmed if his example was right or not.

So for instance now I’ve tried:

name: set_default_enrollment
version: 0.1.0
patches:
 lms-env: |
  "COURSE_MODE_DEFAULTS": {
    "name": "Honor",
    "slug": "honor",
    "bulk_sku": null,
    "currency": "usd",
    "description": null,
    "expiration_datetime": null,
    "min_price": 0,
    "sku": null,
    "suggested_prices": ""
  }
patches:
 lms-env-features: |
  "ENABLE_COURSE_DISCOVERY": false,
  "ENABLE_COURSEWARE_SEARCH": false,
  "ENABLE_DASHBOARD_SEARCH": false

But the net result when I grep for it is:

/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json:    "ENABLE_COURSE_DISCOVERY": false,
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json:    "ENABLE_COURSE_DISCOVERY": true,

So it seems like what he posted above wouldn’t necessarily work, since it seems to just inject the stuff at line 10 of tutor/lms.env.json at 6ca863e04c5943002f94a8bbc877494444242bf9 · overhangio/tutor · GitHub
But, then there will be duplicative values below it. (And my course discovery UI is still not hidden so I assume it’s using the true below the false.)

Also I got the same results (two hits in grep) when I tried a variant from some other thread (How to set ENABLE_COURSEWARE_SEARCH flag in configuration):

patches:
 openedx-common-settings: |
  FEATURES["ENABLE_COURSE_DISCOVERY"] = False,
  FEATURES["ENABLE_COURSEWARE_SEARCH"] = False,
  FEATURES["ENABLE_DASHBOARD_SEARCH"] = False

So what’s the correct way to override an existing variable instead of patching in variables which were not present in the first place? I would think it’s the “config” “set” mechanism, but there’s no example for how to use this in YAML and I can’t write a python plugin

This is the right way to do it. Even better: because these settings are only necessary in the LMS, and not the CMS, you should use the “openedx-lms-common-settings” patch instead of “openedx-common-settings”. (but the latter will work nonetheless)

Values from lms.env.json are picked up by edx-platform/lms/envs/common.py. These values are then overloaded by tutor/production.py. The “openedx-lms-common-settings” patch (and “openedx-common-settings” as well) add content to tutor/production.py. So the latter solution should be working.

To isolate variables, I split this into two plugins and shown below. But you can see that the net result from that is not even duplicate values, but instead just no changes:

tutor@ip-123-123-123-123:/home/ubuntu$ tutor plugins list
discovery==11.0.0
ecommerce==11.0.0 (disabled)
license==11.0.0 (disabled)
minio==11.0.0 (disabled)
notes==11.0.0
xqueue==11.0.0 (disabled)
disable_course_discovery==0.1.0
set_default_enrollment==0.1.0
tutor@ip-123-123-123-123:/home/ubuntu$ nano ~/.local/share/tutor-plugins/disable_course_discovery.yml
tutor@ip-123-123-123-123:/home/ubuntu$ cat ~/.local/share/tutor-plugins/disable_course_discovery.yml
name: disable_course_discovery
version: 0.1.0
patches:
openedx-lms-common-settings: |
FEATURES[“ENABLE_COURSE_DISCOVERY”] = False,
FEATURES[“ENABLE_COURSEWARE_SEARCH”] = False,
FEATURES[“ENABLE_DASHBOARD_SEARCH”] = False
tutor@ip-123-123-123-123:/home/ubuntu$ cat ~/.local/share/tutor-plugins/set_default_enrollement.yml
name: set_default_enrollment
version: 0.1.0
patches:
lms-env: |
“COURSE_MODE_DEFAULTS”: {
“name”: “Honor”,
“slug”: “honor”,
“bulk_sku”: null,
“currency”: “usd”,
“description”: null,
“expiration_datetime”: null,
“min_price”: 0,
“sku”: null,
“suggested_prices”: “”
}

tutor@ip-123-123-123-123:/home/ubuntu$ tutor config save
Configuration saved to /home/tutor/.local/share/tutor/config.yml
Environment generated in /home/tutor/.local/share/tutor/env
tutor@ip-123-123-123-123:/home/ubuntu$ tutor local quickstart

tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_COURSE_DISCOVERY “$(tutor config printroot)/env/apps/openedx/config/”
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json: “ENABLE_COURSE_DISCOVERY”: true,
tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_DASHBOARD_SEARCH “$(tutor config printroot)/env/apps/openedx/config/”
/home/tutor/.local/share/tutor/env/apps/openedx/config/lms.env.json: “ENABLE_DASHBOARD_SEARCH”: true,

So this isn’t even leading to duplicates, it’s just leading to no changes at all.

Should I be seeing changes reflected in the config.yml immediately after “tutor config save”? Because I don’t, and perhaps that means it’s some syntactic parsing issue that’s stopping the plugin from being consumed?

tutor@ip-123-123-123-123:/home/ubuntu$ nano $(tutor plugins printroot)/disable_course_discovery.yml
tutor@ip-123-123-123-123:/home/ubuntu$ tutor config save
Configuration saved to /home/tutor/.local/share/tutor/config.yml
Environment generated in /home/tutor/.local/share/tutor/env
tutor@ip-123-123-123-123:/home/ubuntu$ grep -r ENABLE_COURSE_DISCOVERY /home/tutor/.local/share/tutor/config.yml
tutor@ip-123-123-123-123:/home/ubuntu$

@regis I just wanted to bump this since my site is close to going live but I still haven’t been able to hide courses from the “explore courses” or search. Basically I did exactly what you specified, via a separate plugin, but it didn’t work.

I understand the situation you are in @oedx. However, the problem you are facing is not a bug, it’s a customisation issue, and thus not really my job to address. To help you more, I would have to do the work of creating the plugin and testing it myself. Unfortunately, I do not have the time to do this for free. This is usually the kind of work that people hire me for.

For the thread record, the ultimate solution to my issue which regis helped find was that the discovery plugin had to be disabled because this plugins adds “FEATURES[“ENABLE_COURSE_DISCOVERY”] = True” to the platform settings.

So if we want to utilize Course Searching but hide courses from it, there is no solution to this, if I am following this correctly.

Thanks!

Even though I have the “discovery” plugin disabled, I still have duplicate values of ENABLE_COURSE_DISCOVERY.
Looking at this template file in the source code:

Since the value for ENABLE_COURSE_DISCOVERY has been hard-coded there to “true”, there is no ways to overwrite it to false using a patching plugin!