Backend: create custom role endpoint

Open
#589 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with ADR #469 and the custom-roles model in #561, then trace the existing authorization endpoints and permission dependency handling. Implement the superuser-only POST endpoint with role validation, dependency closure, Casbin policy rows in the same transaction, and the audit event described in #587/#588. Done means success and each listed validation path have tests, including non-superuser rejection.

Written by the indexing model from the issue text.

Description

willow

Implement the create custom role endpoint defined in the ADR (#469): create a user_defined role for a single resource type with a name, description and an initial permission set, persisted via the custom-roles model (#561) and rendered to Casbin p rows in the same transaction.

Superuser-only. Enforces: single resource type per role; name validation/uniqueness; permission ids valid for the resource type; dependency closure applied (a selected permission pulls in its required dependencies). Backs the create wizard (#571–#573).

Acceptance
  • POST creates a custom role with resource type + permissions; p rows rendered in the same transaction.
  • Superuser-only; non-superuser rejected.
  • Single-resource-type and name-uniqueness validation (400 on violation).
  • Dependency closure enforced server-side (not only in the UI).
  • Audit event recorded (see #587/#588); tests for success and each validation path.
Dominant language
Python
Stars
0
Forks
10
Avg merge
3d 4h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openedx/openedx-authz

All issues in openedx/openedx-authz

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.