<@U04UQ68083H> I have the following permission mod...
# ory-copilot
m
@chilly-king-10285 I have the following permission model:
Copy code
class Company implements Namespace {
  related: {
    admins: User[]
  }

  permits = {
    owner: (ctx: Context): boolean =>
      this.related.admins.includes(ctx.subject)
  }
}
class LearningPlan implements Namespace {
  related: {
    owners: User[]
    companies: Company[]
  }

  permits = {
    owner: (ctx: Context): boolean =>
      this.related.companies.traverse((parent) => parent.permits.owner(ctx)) ||
      this.related.owners.includes(ctx.subject)
  }
}
With these relations: • Subject
companies/simpleclub
is
companies
of Object
LearningPlan:learning_plans/xyz
• Subject
users/abc
is
admins
of Object
Company:companies/simpleclub
Why does this request
https://{project-slug}.<http://projects.oryapis.com/relation-tuples/checknamespace=LearningPlan&object=learning_plans/xyz&relation=owner&subject_id=users/abc&max-depth=20|projects.oryapis.com/relation-tuples/checknamespace=LearningPlan&object=learning_plans/xyz&relation=owner&subject_id=users/abc&max-depth=20>
return
{"allowed": false}
c
A message from kapa.ai
New message text here