Code Monkey home page Code Monkey logo

edx-username-changer's Introduction

edx-username-changer

A plugin to enable update usernames through admin panel in Open edX (and other apps that log into Open edX via OAuth). It only supports koa and latest releases of Open edX.

Installation

Installing Plugin

You can install it into any Open edX instance by using the following two methods:

To get the latest stable release from PyPI

pip install edx-username-changer

To get the latest commit from GitHub

pip install -e git+https://github.com/mitodl/edx-username-changer.git@master#egg=edx-username-changer

Configuring Plugin into Open edX

To configure this plugin, you need to do the following one step:

  1. Add/Enable a feature flag (ENABLE_EDX_USERNAME_CHANGER) into your environment variables (through lms.yml or studio.yml, depending upon where you are installing the plugin)
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):

  1. Install edx-username-changer plugin.
  2. Use an admin account to access django admin panel.
  3. Go to Users model and select an account to change its username.
  4. In the account editor page change the username field.
  5. Hit Save (present at the bottom-right of page).

The whole process can be done on lms or studio or on both of them.

edx-username-changer's People

Contributors

arslanashraf7 avatar dependabot[bot] avatar hamzaibnfarooq avatar odlbot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edx-username-changer's Issues

add support for django 3.2

edX has published a guide for upgrading repos to django 3.2: https://openedx.atlassian.net/wiki/spaces/AC/pages/1704591765/Django+3.2+Upgrade+Steps+to+Upgrade+a+Repository

acceptance criteria

Django 3.2 migration checklist

  • Update django version in tox.ini, github actions flow and there are scripts in https://github.com/edx/repo-tools/tree/master/edx_repo_tools/codemods/django3 that can make code compatible to django3 in most cases
  • Upgrade any packages that were being held back only because of missing support for one of the removed Python / django versions
  • Install pyupgrade-directories package and run pyup-dirs --py3-plus --py36-plus --py38-plus --recursive . in the repo root folder to clean up code that was only present to support older Python versions. You may want to run each of the --py* options in a separate PR if they make a lot of changes.
  • Run the codemod scripts in https://github.com/edx/repo-tools/tree/master/edx_repo_tools/codemods/django3 (such as replace_unicode_with_str.py and script_to_replace_static.sh) to automatically fix some code patterns known to break under Django 3.2.
  • Fix any deprecation warnings related to Django 3.0 or 3.1 that occur when the tests are run with Django 2.2
  • Fix any remaining Django deprecation warnings or test failures in all the test configurations. But don’t fix deprecation warnings from the Django 3.2 tests yet, fixes for them are likely to break compatibility with Django 2.2 which we still need for now.
  • If any of the new test configurations were allowed to fail when added, update the configuration to no longer allow them to do so.
  • Update the Trove classifiers in any setup.py, setup.cfg, or pyproject.toml files to reflect the Python and Django versions currently being tested
  • For packages already on PyPI, go ahead and make a new release so the Trove classifiers are updated there also. This should be a major version bump if support for older Python releases was dropped.
  • If the repository is an IDA, go ahead and update it to deploy on Django 3.2 once all of the new test configurations are passing cleanly.

Add test framework and linting

Description

The plugin is in working form but basic stuff like Testing, Github Actions, and Quality checks are not in place right now. Thus this issue is meant to add all the basic features to the plugin.

Acceptance Criteria

  • Enable testing
  • Add Quality related plugins
  • Enable CI using github actions

Note

It would be better if we inherit the plugin with cookiecutter-django-app

Add comment client paging support

The results that are returned by the openedx comment client are paged, and this app does not account for that paging. As a result, we only inspect the first 20 threads or comments that a user has been involved in. It's possible that the paging was added after we created this app.

Implementation:

These are the functions I used to debug this issue locally and fix a single user. If you use this code, just replace the existing get_authored_threads_and_comments function instead of naming it get_authored_threads_and_comments_v2 as I did here.

course_id = '...'
user = User.objects.get(username='...')
#
def get_involved_threads(course_id, user_id):
  page = 0
  involved_threads = []
  while len(involved_threads) > 0 or page == 0:
    involved_threads = [ 
      Thread.find(id=thread["id"]).retrieve(
        with_responses=True, recursive=True, mark_as_read=False
      )
      for thread in Thread.search(
        {"course_id": course_id, "user_id": comment_user.id, "page": page}
      ).collection
    ]
    yield from involved_threads
    page += 1
#
def get_authored_threads_and_comments_v2(comment_user, enrolled_course_ids):
  for course_id in enrolled_course_ids:
    involved_threads = get_involved_threads(course_id, comment_user.id)
    for thread in involved_threads:
      if thread["user_id"] == comment_user.id:
        yield thread.to_dict()
      children_to_scan = thread["children"]
      while children_to_scan:
         child = children_to_scan.pop(0)
         children_to_scan.extend(child["children"])
         if child["user_id"] == comment_user.id:
            yield child

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.