I have developed a WordPress-based website using Toolset, enabling our customers to view and manage their data seamlessly. The data structure includes the following tables:
- **Customers** (customer information)
- **Contacts**
- **Domains**
- **Autoresponders**
- etc.
### Data Relationships
- Each customer can have multiple associated contacts.
- Each customer can own multiple domains.
- Each customer can manage several autoresponders.
- etc.
### Access Requirements
Each customer should be able to see, edit, and delete only their own data. To test this setup, I created a user with the role of “author” for a sample customer and linked all relevant posts to this user. In Toolset I restricted the access to admins and the related author. However, manually assigning roles or authors for every new data entry is not scalable.
### Optimized Access Solution
Given that each user corresponds to a single customer and all his data is associated with this customer, an efficient method for data access control is required. This will ensure that users are automatically granted permissions relevant to their associated customer data.
### Example Scenario
**Customer: Amargo** (with associated users A and B)
- **Related Contacts**: Contact 1, Contact 2, Contact 3
- **Related Domains**: Domain 1, Domain 2
- **Related Autoresponders**: Autoresponder 1, Autoresponder 2, Autoresponder 3
**Customer: CustomerName** (with associated user C)
- **Related Contacts**: Contact 8, Contact 9
- **Related Domains**: Domain 3, Domain 5
- **Related Autoresponders**: Autoresponder 7
### User Access Control
- **Users A and B** should have exclusive access to:
- Contacts: Contact 1, Contact 2, Contact 3
- Domains: Domain 1, Domain 2
- Autoresponders: Autoresponder 1, Autoresponder 2, Autoresponder 3
- **User C** should have exclusive access to:
- Contacts: Contact 8, Contact 9
- Domains: Domain 3, Domain 5
- Autoresponder: Autoresponder 7
By implementing a dynamic permission system based on user-customer relationships, we can automate data access controls and improve site management efficiency.
Is there a way to achieve this?