Loki_CompanyAccounts
This module adds company accounts to Magento 2: Customers can be placed under a company with a role (owner, manager, buyer, approver, accountant, or any custom role), each role with its own permissions.
Features
- Admin Panel: Customers > Companies to create companies, assign an owner and add, change or remove members.
- Admin Panel: Customers > Company Roles to create roles and to configure the permissions of each role.
- Frontend: a My Company link in the customer account (only for company members) that shows the company, its members and your own role and permissions.
- Customers with the permission Manage company users can assign customers to their company by email, change their role or remove them. If no customer exists with that email yet, a new account is created and the customer receives an email to set a password.
- Customers that belong to a company can only place orders when their role has the permission Place orders.
- The company owner is always allowed everything. Ownership can only be transferred from the Admin Panel.
- A customer can only belong to one company.
Permissions
The following permissions are available by default:
| Code | Label |
|-----------------|-----------------------------------------|
| view_company | View company information and members |
| manage_users | Manage company users |
| place_order | Place orders |
| approve_order | Approve orders |
| view_orders | View company orders |
| view_invoices | View invoices |
Only view_company, manage_users and place_order are enforced by this module. The other permissions are
available for other modules to check via Loki\CompanyAccounts\Api\PermissionCheckerInterface::isAllowed().
New permissions can be added via DI:
<type name="Loki\CompanyAccounts\Permission\PermissionListing"> <arguments> <argument name="permissions" xsi:type="array"> <item name="my_permission" xsi:type="string">My permission</item> </argument> </arguments> </type>
Configuration
loki_company_accounts/general/enabled(Stores > Configuration > Customers > Company Accounts)
Installation
Install this package via composer:
composer require loki/magento2-company-accounts
Next, enable this module:
bin/magento module:enable Loki_CompanyAccounts
Current status
@dev
to the composer command.
Support
For getting support, create an Issue under the following project URL:
https://gitlab.yireo.com/loki-extensions/Loki_CompanyAccounts.git
Configuration Options
The following options of this module can be configured via the Store Configuration:
loki_company_accounts/general/enabled
Module Dependencies
The following dependencies are declared in the module its `etc/module.xml` file:
Magento_Backend
Magento_Customer
Magento_Quote
Magento_Store
Composer details
Loki_CompanyAccountsloki/magento2-company-accounts
magento/framework: ^103.0
magento/module-backend: ^102.0
magento/module-customer: ^103.0
magento/module-quote: ^101.0
magento/module-store: ^101.0
php: >=8.2 <8.6
Releases
Changelog
Added
- Companies, company roles and company members (database tables, repositories, service contracts)
- Default roles Owner, Manager, Buyer, Approver and Accountant
- Admin Panel pages to manage companies, members and roles with their permissions
- Frontend "My Company" page to view the company and to assign customers by email
- Invitation of new customers (account without password) when assigning an unknown email
- Place-order permission check for company members
- Unit, integration and Playwright tests
- Company email domains (
email_domain), editable in the Admin Panel