fix(opportunity): fix dead creator check in kanban move RBAC

is_owner compared request.profile (a Profile) to opportunity.created_by (a
User FK), which is never equal, so a non-admin creator who is not also an
assignee was wrongly denied moving their own deal. Compare user ids, matching
the detail-view RBAC.
This commit is contained in:
Rohit10jr 2026-08-10 19:38:13 +05:30
parent 799bb12102
commit 56fe450ab4

View file

@ -182,7 +182,7 @@ class OpportunityMoveView(APIView):
# Match Opportunity update/delete RBAC: admin OR creator OR assignee.
if not is_org_admin(request.profile) and not request.user.is_superuser:
is_owner = request.profile == opportunity.created_by
is_owner = request.profile.user_id == opportunity.created_by_id
is_assignee = request.profile in opportunity.assigned_to.all()
if not (is_owner or is_assignee):
return Response(