Skip to content

Restrict lead status changes by role and ownership#3

Open
mprinceb wants to merge 3 commits intovvfrom
codex/update-lead-status-permissions-for-sales-user
Open

Restrict lead status changes by role and ownership#3
mprinceb wants to merge 3 commits intovvfrom
codex/update-lead-status-permissions-for-sales-user

Conversation

@mprinceb
Copy link
Member

@mprinceb mprinceb commented Feb 7, 2026

Motivation

  • Prevent unauthorized users from changing a lead's top-right status in the UI while allowing owners and higher roles to edit it.
  • Ensure programmatic attempts to change status are blocked if the user lacks permission.

Description

  • Added a canChangeLeadStatus computed property to frontend/src/pages/Lead.vue that returns true for Admin/System Manager, Sales Manager and Sales Master Manager, or for a Sales User when doc.owner === session.user.
  • Updated the status control to render the editable Dropdown only when canChangeLeadStatus is true and render a read-only Button showing the status otherwise.
  • Added a guard in triggerStatusChange to display an error toast and abort when canChangeLeadStatus is false.
  • All changes are contained in frontend/src/pages/Lead.vue.

Testing

  • Ran yarn build which failed in this environment due to missing local Frappe files (sites/common_site_config.json and frappe/frappe/public/js/lib/posthog.js).
  • Started the dev server with cd frontend && yarn dev to validate UI changes; the server started but runtime import resolution errors for the same missing local files were observed in this environment.
  • Captured a browser screenshot of the running app shell via an automated Playwright script to visually validate the lead page rendering, which produced an artifact successfully.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant