# multi_vendor **Repository Path**: lynnguinan/multi_vendor ## Basic Information - **Project Name**: multi_vendor - **Description**: No description available - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-08-21 - **Last Updated**: 2024-08-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Multi Vendor ![Multi Vendor Flow](images/Multi_Vendor2.png) Multi Vendor is an app designed for managing a platform where multiple vendors can register, manage their products, and interact with buyers and brokers. The app ensures strict data segregation based on user roles (Vendor, Buyer, Broker) and provides role-specific features and access. ## Architecture ### DocTypes - **Vendor**: Stores information related to vendors. - **Buyer**: Stores information related to buyers. - **Broker**: Stores information related to brokers. - **User**: Core DocType where each user is registered with their email and password. This is essential as every user must log in to interact with the system. Roles are assigned here based on the portal they belong to. - **Multi-Vendor Access Settings**: Manages access control by dynamically assigning roles (Vendor, Buyer, Broker) to users based on their assigned portal. ### Portal Pages - **Vendor Portal**: Accessible at `/vendor-portal` - **Buyer Portal**: Accessible at `/buyer-portal` - **Broker Portal**: Accessible at `/broker-portal` ### Web Forms - **Vendor Signup Form**: Accessible at `/vendor-signup-form` - **Buyer Signup Form**: Accessible at `/buyer-signup-form` - **Broker Signup Form**: Accessible at `/broker-signup-form` ### Relationships Based on DocTypes and Flow 1. **User <--> Vendor, Buyer, Broker**: - Each user can only have one of the roles: `Vendor`, `Buyer`, or `Broker`. A user can have multiple roles, but only one of these three will control their access to the respective portal. - Users without any of these roles can access any general pages but cannot access the specific portals unless assigned the corresponding role. - **Administrators** can access all portals without restrictions as they possess roles outside of the restricted roles. 2. **Vendor <--> Products**: Each vendor manages multiple products. Products are linked to the `Vendor`. 3. **Buyer <--> Orders**: Each buyer places multiple orders. Orders are linked to the `Buyer`. 4. **Broker <--> Deals**: Brokers facilitate deals between buyers and vendors. Deals are linked to both `Buyer` and `Vendor`. ### Multi-Vendor Access Settings Logic The **Multi-Vendor Access Settings** DocType is designed to control user access dynamically based on the portal they are associated with: - **User Field**: Links to the user whose access is being controlled. - **Portal Field**: Selects the portal the user is assigned to (`vendor-portal`, `broker-portal`, `buyer-portal`). **Validation Logic**: - When the portal is changed, the user's roles are adjusted automatically: - If assigned to `vendor-portal`, the user's role is set to `Vendor` and the roles `Buyer` and `Broker` are removed. - If assigned to `broker-portal`, the user's role is set to `Broker` and the roles `Vendor` and `Buyer` are removed. - If assigned to `buyer-portal`, the user's role is set to `Buyer` and the roles `Vendor` and `Broker` are removed. This ensures that each user has access only to the portal they are assigned to, maintaining strict role-based access control. ### Flow - **Sign-Up Flow**: New users (vendors, buyers, brokers) complete their respective signup forms, creating entries in the `Vendor`, `Buyer`, or `Broker` DocTypes, and are redirected to their portals. Additionally, an entry is created in the `Multi-Vendor Access Settings` DocType to manage their access based on the portal they are assigned. - **Vendor Signup**: During signup, vendors provide their related business information, which is stored in the `Vendor` DocType. This includes details like company name, address, contact information, etc. - **Buyer Signup**: Buyers provide their personal and payment information, which is stored in the `Buyer` DocType. This includes details like name, address, payment preferences, etc. - **Broker Signup**: Brokers provide their brokerage details, which are stored in the `Broker` DocType. This includes information like company name, contact information, and areas of expertise. These details are crucial for the functioning of each portal, as they help in the proper categorization and interaction of users within the system. - **Login Flow**: Users log in and are redirected to their respective portal based on their role (vendor, buyer, broker). If they haven’t filled out the signup form, they are first redirected to the appropriate form. - **Access Control**: The system dynamically adjusts user roles using the `Multi-Vendor Access Settings` to ensure that users can only access the portals they are permitted to. Users without roles such as `Vendor`, `Buyer`, or `Broker` can still log in and access general areas, but they are restricted from accessing specific portals. ## Installation 1. Get the app: ```bash bench get-app https://github.com/yourusername/multi_vendor.git ``` 2. Install the app on your site: ```bash bench --site yoursite install-app multi_vendor ``` ## License MIT