Skip to content

Commit

Permalink
edx-username-changer plugin settings added (#424)
Browse files Browse the repository at this point in the history
* feat: edx-username-changer plugin settings added

* fix: remove CMS entrypoint
docs: update licence year

* fix: build file, entrypoint and plugin settings updated

* docs: FEATURE flag setting added for lms.env.yml file

* fix: FEATURES setting fixed
  • Loading branch information
marslanabdulrauf authored Jan 21, 2025
1 parent fba0ecf commit df9c5cb
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/edx_username_changer/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python_sources(
name="edx_username_changer_source",
dependencies=["src/edx_username_changer/settings:edx_username_changer_settings"],
)

python_distribution(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2022 MIT Open Learning
Copyright (C) 2025 MIT Open Learning

All rights reserved.

Expand Down
16 changes: 13 additions & 3 deletions src/edx_username_changer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,32 @@ Follow these steps in a terminal on your machine:

1. Navigate to ``open-edx-plugins`` directory
2. Run ``./pants package ::``. This will create a "dist" directory inside "open-edx-plugins" directory with ".whl" & ".tar.gz" format packages for all plugins in the src directory
3. Move/copy any of the ".whl" or ".tar.gz" files for this plugin that were generated in the above step to the machine/container running Open edX (NOTE: If running devstack via Docker, you can use ``docker cp`` to copy these files into your LMS or CMS containers)
3. Move/copy any of the ".whl" or ".tar.gz" files for this plugin that were generated in the above step to the machine/container running Open edX (NOTE: If running devstack via Docker, you can use ``docker cp`` to copy these files into your LMS containers)
4. Run a shell in the machine/container running Open edX, and install this plugin using pip


``Note``: In some cases you might need to restart edx-platform after installing the plugin to reflect the changes.

Configurations
--------------
To configure this plugin, you need to do the following one step:
To configure this plugin, you need to do one of the following steps:

1. Add/Enable a feature flag (ENABLE_EDX_USERNAME_CHANGER) into your environment variables (through ``private.py`` in LMS or CMS, depending upon where you are installing the plugin)
1. Add/Enable a feature flag (ENABLE_EDX_USERNAME_CHANGER) into your environment variables (through ``private.py`` in LMS)

.. code-block::
FEATURES["ENABLE_EDX_USERNAME_CHANGER"] = True
2. Add/Enable a feature flag (ENABLE_EDX_USERNAME_CHANGER) into your environment variables (through ``lms.env.yml`` file)

.. code-block::
FEATURES:
...
ENABLE_EDX_USERNAME_CHANGER: True
...
How to use
----------
Its usage is as simple as changing the username of a user account through django's admin panel. Here are the steps (for clarity):
Expand Down
1 change: 1 addition & 0 deletions src/edx_username_changer/settings/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python_sources(name="edx_username_changer_settings")
21 changes: 21 additions & 0 deletions src/edx_username_changer/settings/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# noqa: INP001

"""Settings to provide to edX"""


def plugin_settings(settings):
"""
Populate common settings
"""
env_tokens = getattr(settings, "ENV_TOKENS", {})

# .. toggle_name: FEATURES['ENABLE_EDX_USERNAME_CHANGER']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Enable the username changer feature
# .. toggle_use_case: open_edx
# .. toggle_creation_date: 2025-01-15

settings.FEATURES["ENABLE_EDX_USERNAME_CHANGER"] = env_tokens.get(
"FEATURES", {}
).get("ENABLE_EDX_USERNAME_CHANGER", False)
10 changes: 10 additions & 0 deletions src/edx_username_changer/settings/devstack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# noqa: INP001

"""Settings to provide to edX"""


def plugin_settings(settings):
"""
Populate devstack settings
"""
settings.FEATURES["ENABLE_EDX_USERNAME_CHANGER"] = False

0 comments on commit df9c5cb

Please sign in to comment.