Use Cases & Examples
Use Case 1: Sales Team - Territory-Based Access
Scenario: Sales reps should only see customers in their assigned territory.
Setup:
- Create team: "Sales Team North"
- Add team members: northern sales reps
- Grant access to
customerstable - Set table restriction:
territory == 'North'
Result: Team members only see customers where territory = 'North'
Use Case 2: Sales Rep - Individual Assignment
Scenario: Each sales rep should only see their assigned customers and their sales data.
Setup:
Create team: "Sales Representatives"
Add all sales reps as members
Grant access to tables:
customerssales_orders
Set table restrictions:
For
customerstable:sales_person == frappe.session.userFor
sales_orderstable:sales_person == frappe.session.user
Result:
- John (john@company.com) only sees customers/orders where
sales_person = 'john@company.com' - Jane (jane@company.com) only sees customers/orders where
sales_person = 'jane@company.com'
Use Case 3: Manager - Team View
Scenario: Sales managers should see all data for their team members.
Setup:
Create team: "Sales Managers West"
Add managers as members
Grant access to same tables as reps
Set table restrictions:
For
customerstable:sales_person_region == 'West'Or if you have a manager column:
manager == frappe.session.user
Result: Managers see all their team's data, reps see only their own.
Use Case 4: Finance Team - AR Visibility
Scenario: AR team should see all invoices, but only for active customers.
Setup:
Create team: "Accounts Receivable"
Add AR team members
Grant access to:
customerssales_invoicespayments
Set table restrictions:
For
customerstable:status == 'Active' AND outstanding_amount > 0For
sales_invoicestable:status != 'Paid' AND due_date IS NOT NULL
Result: AR team sees all unpaid invoices for active customers.
Use Case 5: Multi-Company Access
Scenario: Users should only see data for their assigned company/branch.
Setup:
Create teams per company: "Company A Team", "Company B Team"
Grant access to shared tables
Set table restrictions:
company == 'Company A'
Result: Users in "Company A Team" only see Company A data across all tables.
Use Case 6: Time-Based Access
Scenario: Analysts should only see recent data.
Setup:
Create team: "Junior Analysts"
Grant access to transaction tables
Set table restrictions:
transaction_date >= '2024-01-01'
Result: Analysts can't see historical data older than specified date.