Skip to content

Navigation Menu

Sign in
Sign up

Other users with course:manage can add lessons to the products they don't own #797

Open
Assignees
Labels
bugSomething isn't working

Description

Because createLesson checks only the global permission string, not course ownership.

In apps/web/graphql/lessons/logic.ts, the flow is:

  1. Authenticate user.
  2. Require course:manage.
  3. Fetch course by courseId and domain.
  4. Create lesson and push it into that course.

The missing check is between steps 3 and 4. It should call the existing owner-aware helper, like:

if (!canManageCourseInContext(course, ctx)) {
 throw new Error(responses.action_not_allowed);
}

That helper already encodes the intended rule in apps/web/graphql/courses/permissions.ts: course:manage_any can manage any course, while course:manage can manage only owned courses.

So the root cause is: createLesson treats course:manage as tenant-wide course management. Also, the public API lesson creation route delegates to the same function at apps/web/app/api/products/[productId]/lessons/route.ts, so fixing createLesson should close both GraphQL and REST creation paths.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    AltStyle によって変換されたページ (->オリジナル) /