Skip to content

[Tagging] Taxonomy view/management APIs #73

@pomegranited

Description

@pomegranited

Story

"As a Taxonomy Administrator, I want to be able to create, edit, and delete taxonomies so that I can manage the tagging fields and tags available for content authors."

Full description

ref MVP discovery

Implement a Django Rest Framework (DRF) REST API that allows listing and retrieving, and editing taxonomies available to the logged-in user and their metadata (taxonomy name, etc). This REST API will be used by the taxonomy management frontend, to be developed later.

  • views: support
    • add new taxonomy with metadata: name, description, enabled, required, allow_multiple, allow_free_text
      Should not be able to change the fields system_defined or _taxonomy_class
      • view a taxonomy: return metadata
      • edit metadata for an existing taxonomy
      • delete a taxonomy
    • permissions: these REST APIs should only allow editing taxonomy metadata or deleting taxonomies if the user is allowed to.
      Implement DRF-compatible permissions classes using the rules.py added by [Tagging] Implement Taxonomy Data Architecture models + APIs #63, e.g.
      python request.user.has_perm("oel_tagging.add_taxonomy") # Can the current user add a new taxonomy? request.user.has_perm("oel_tagging.change_taxonomy", taxonomy) # Can the current user edit this taxonomy?
      These rules should use the most appropriate context available, i.e inside openedx-learning, they'll use the rules defined in openedx_tagging/core/tagging/rules.py, but inside Studio, they'll use the overwritten rules defined in openedx/features/content_tagging/rules.py
      Refer to the Users section of the MVP for a detailed permissions breakdown.
  • code: the REST APIs should be thin; most of the code you need already exists in the python APIs (if you need more, err towards adding to those APIs, keeping the views minimal)
  • structure: add new files to openedx-learning under openedx_tagging/core/tagging/rest_api/v1/: views.py, permissions.py, serializers.py, urls.py
    See other REST APIs in edx-platform for examples, e.g. course_api
  • endpoints: these endpoints will be exposed as URLs in Studio, since oel_tagging is a ensure they're accessible in under <studio root>/api/v1/content_tagging/
  • documentation: these REST API views should be documented like the ones in the platform, see e.g. e.g. course_api views

Note: this API doesn’t include editing taxonomy tags, just its metadata. In this phase, taxonomy tags can only be edited through the
import/export APIs.

Completion criteria

  • PR against openedx-learning to add the REST API views, supporting code, and tests, specifically verifying permissions are enforced.
  • PR against edx-platform to add permissions tests for these views in the content_tagging context (no need to test the views themselves here; those tests will live with their code ^), and bump the version of openedx-learning if required.
  • Automated testing must cover all code added here.

Documentation updates & improvements criteria

  • If you find anything amiss in the docs/ or README when working on this change, feel free to update them too.

Relevant repositories

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions