Skip to content

Role and Permission Mapping

Role and Permission Mapping

This section documents the role mappings from B2B Suite to B2B Commercial, detailing how permissions and roles are transformed during the migration. Roles define the permissions assigned to employees within the B2B Commercial, and dependencies ensure that related permissions are included to maintain functionality. This reference is essential for developers to understand how roles and permissions are structured in the new system.

Permission Mapping

Below is the mapping of permissions from B2B Suite to B2B Commercial. Each permission from B2B Suite is mapped to a corresponding permission in B2B Commercial.

INFO

Some permissions in B2B Suite do not actually exist in B2B Commercial, because some features are not available in B2B Commercial. In this case, the permission would be mapped to nearest equivalent permission in B2B Commercial.

B2B Suite RoleB2B Commercial RoleDependenciesCategory
address_assignorganization_unit.shipping_address.createorganization_unit.billing_address.create, organization_unit.create, organization_unit.updateAddress
address_createorganization_unit.shipping_address.createorganization_unit.billing_address.create, organization_unit.create, organization_unit.updateAddress
address_deleteorganization_unit.shipping_address.deleteorganization_unit.billing_address.deleteAddress
address_detailorganization_unit.shipping_address.updateorganization_unit.billing_address.update, organization_unit.create, organization_unit.updateAddress
address_listorganization_unit.readorganization_unit.create, organization_unit.updateAddress
address_updateorganization_unit.shipping_address.updateorganization_unit.create, organization_unit.updateAddress
budget_assignapproval_rule.createNoneBudget
budget_createapproval_rule.createNoneBudget
budget_deleteapproval_rule.deleteNoneBudget
budget_detailapproval_rule.readNoneBudget
budget_listapproval_rule.readNoneBudget
budget_updateapproval_rule.updateNoneBudget
company_listorganization_unit.readNoneCompany
contact_createemployee.createemployee.read, employee.edit, role.readContact
contact_deleteemployee.deleteemployee.read, employee.edit, role.readContact
contact_detailemployee.readNoneContact
contact_listemployee.readNoneContact
contact_updateemployee.editemployee.read, role.readContact
contingent_assignapproval_rule.createNoneContingent
contingent_createapproval_rule.createNoneContingent
contingent_deleteapproval_rule.deleteNoneContingent
contingent_detailapproval_rule.readNoneContingent
contingent_listapproval_rule.readNoneContingent
contingent_updateapproval_rule.updateNoneContingent
contingentrule_createapproval_rule.createNoneContingent Rule
contingentrule_deleteapproval_rule.deleteNoneContingent Rule
contingentrule_detailapproval_rule.readNoneContingent Rule
contingentrule_listapproval_rule.readNoneContingent Rule
contingentrule_updateapproval_rule.updateNoneContingent Rule
fastorder_createquote.requestNoneOrder
offer_createquote.requestNoneOrder
offer_deletequote.declineNoneOrder
offer_detailquote.read.allNoneOrder
offer_listquote.read.allorganization_unit.quote.readOrder
offer_updatequote.request_changequote.acceptOrder
order_createorganization_unit.order.readNoneOrder
order_deletepending_order.approve_decline_allpending_order.read_all, pending_order.approve_declineOrder
order_detailorder.read.allNoneOrder
order_listorder.read.allNoneOrder
order_updateorder.read.allNoneOrder
role_assignrole.createrole.read, role.editRole
role_createrole.createrole.read, role.editRole
role_deleterole.deleterole.read, role.editRole
role_detailrole.editrole.readRole
role_listrole.readNoneRole
role_updaterole.editrole.readRole
route_assignrole.createrole.read, role.editRoute
route_detailrole.editrole.readRoute
route_listrole.readNoneRoute

INFO

In case you want to override the default mapping, either to add new permissions or change existing ones, you can do so by subscribing to the Shopware\Commercial\B2B\B2BSuiteMigration\Core\Domain\Event\B2BMigrationPermissionEvent event. This allows you to customize permission mapping according to your specific requirements.

Role Mapping

B2B Suite and B2B Commercial have different approaches to role assignments, impacting how roles are migrated:

  • B2B Suite: An employee can be assigned multiple roles, each with specific permissions, and may also have individual permissions not tied to a role.
  • B2B Commercial: An employee is assigned a single role that contains all their permissions.

To handle this difference, the migration process uses the following cases to assign roles to employees in B2B Commercial:

  1. Single Role in B2B Suite
    If an employee in B2B Suite has only one role, that role is migrated to B2B Commercial as is, retaining its permissions and dependencies as defined in the role mapping table below.

  2. Multiple Roles in B2B Suite
    If an employee has multiple roles, these roles are merged into a single role in B2B Commercial. The new role includes all permissions from the original roles (including their dependencies). The role name is a combination of the original role names, joined with underscores.
    Example: An employee with roles role1, role2, and role3 will have a new role named role1_role2_role3 in B2B Commercial, containing all permissions from these roles.

  3. Multiple Roles with Specific Permissions in B2B Suite
    If an employee has multiple roles and additional specific permissions not tied to a role, these are merged into a single role in B2B Commercial. The new role includes all permissions from the roles and the specific permissions. The role name is a combination of the original role names and the employee’s email address, joined with underscores.
    Example: An employee with email foo@gmail.com, roles role1 and role2, and specific permissions will have a new role named role1_role2_foo@gmail.com in B2B Commercial.

INFO

After migration, you can rename roles in B2B Commercial to more meaningful names, but the permissions will remain unchanged.