How to enable feature flags? (ALLOW_PUBLIC_ACCOUNT_CREATION)

Hi there,

I am trying to disable public account creation. I have found plenty of references to setting the feature flag “‘ALLOW_PUBLIC_ACCOUNT_CREATION’”

https://docs.openedx.org/projects/edx-platform/en/latest/references/featuretoggles.html#featuretoggle-FEATURES[‘ALLOW_PUBLIC_ACCOUNT_CREATION’]

I am at a loss how to set this. I think its can be put in config.yml for tutor but I am not sure of the syntax. I see references to writing a snippet of python code to change this setting but that seems really ott for just setting a feature flag and not sure if this mean I will need to run this script everyt time the docker container is recreated.

I have found this:

https://docs.openedx.org/en/latest/site_ops/how-tos/add-waffle-flag-for-user.html

But there is no DJANGO-WAFFLE > Flags option under “Admin”

So the basic question is how to set feature flags in Openedx installed with tutor?

Thanks

Hi @mxc

Follow this documentation: Creating a Tutor plugin — Tutor documentation

Here are the same things explained.

Create a python plugin like this and name it anything you like, eg RestrictRegistrations.py
Then you can enable it with tutor plugins enable RestrictRegistrations

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-common-settings",
        "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
    )
)

Thanks for the link. Makes sense now. I have a question. I want to disable the sign up link on the lms and cms so I did this:

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-common-settings",
        "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
    )
)

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-cms-common-settings",
        "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
    )
)

But the link on the cms (studio.domain.com) still allows account creation.

I’m not sure how to completely remove the sign-up link on the homepage, but with the patch I gave you (at least for me) it does not let you actually proceed with registering, if you fill in all the details and then try register nothing will happen.

Sorry for the delayed feedback. I managed to get rid of the link on the cms with a combinbation of the following: (My memory is a bit hazy now so I may get some details wrong. I am posting this in case it helps others.)

vi .local/share/tutor-plugins/disable-pubic-account-creation.py

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-common-settings",
        "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
    )
)

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-cms-common-settings",
        "ALLOW_PUBLIC_ACCOUNT_CREATION = False"
    )
)

hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-cms-common-settings",
        "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
    )
)

# Hide Login Link from Authn MFE
hooks.Filters.ENV_PATCHES.add_item(
    (
        "openedx-lms-production-settings",
        """MFE_CONFIG["SHOW_REGISTRATION_LINKS"] = False"""
    ),
)

vi /home/jbadmin/.local/share/tutor/env/apps/openedx/settings/cms/production.py

ALLOW_PUBLIC_ACCOUNT_CREATION = False
FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False

HTH

1 Like