Roles are assigned based on the MemberRegistrationAttributes.xml file, which follows the format defined by the MemberRegistrationAttributes.dtd file. Both the DTD and XML files are located in the WC_installdir/instance/xml/member directory.
Upon member (that is, user, buyer, or reseller) registration, the MemberRegistrationAttributes.xml file is used to determine which roles should be assigned to members within the WebSphere Commerce system. This file is divided into four sections or elements:
- UserRoles - The UserRoles section is used to define roles in an organization and includes roles defined by name, registrationType, or DN (distinguished name).
- OrganizationRoles - OrganizationRoles is used to define roles for organizations and includes roles defined by with name only.
- BusinessEntities - The BusinessEntities section is used to list the organizations that act as business entities.
- RegistrationParents - The RegistrationParents section is used to define where to create new users or organizations for a particular registration type.
UserRoles
The UserRoles section contains User nodes. The role assignment algorithm iterates through the list of User nodes, and returns the first one that matches. This process is based on the following:
- The registrationType (for example, userRegistration, ResellerRegistration, BuyerRegistration).
- The memberAncestor (the organizations and organizational units that make up the user's ancestor tree)
- The store ancestor (the organizations and organizational units that make up the ancestor tree of the store to which the user is registering). For each user ancestor, the file looks for User nodes that match the registrationType and storeAncestor, and returns the first group from each ancestor that matches.
When a role group is found that matches the outer criteria, WebSphere Commerce attempts to assign the roles in the group to the user or organization. Each role consists of the following:
- A name (in the case of roles for organization, this is the only attribute that is required).
- A roleContext, which can have the following values:
- userParent - The role is applied to the organization that is the user's immediate parent.
- storeOwner - The role is assigned to the organization that owns the store to which the user is registering.
- explicit - The role is assigned to a DN that is explicitly specified. The last attribute is DN, which in the case of explicit role type, WebSphere Commerce assigns the role to this organization. In the case of the storeOwner or userParent, the organization resolved to must be a descendant of the DN specified.
The following is an example for UserRoles:
<UserRoles> <User registrationType="UserRegistration" memberAncestor="o=Default Organization,o=Root Organization" storeAncestor="o=Root Organization"> <Role name="Registered Customer" roleContext="storeOwner" DN="o=Reseller Organization,o=Root Organization"/> <Role name="Registered Customer" roleContext="storeOwner" DN="o=Seller Organization,o=Root Organization"/> ... </UserRoles>
In this example, the WebSphere Commerce scans down the list of User nodes until it finds one that matches. The matching is determined by the following:
- The registrationType (thus, the system is invoking a standard UserRegistrationAdd command).
- The member’s ancestor (in this case, the user’s parent organization must be somewhere under the default organization).
- The store’s ancestor (in this case, the system matches on any store, because the store ancestor is defined as the root organization which is an ancestor of every store).
Once WebSphere Commerce locates a matching role group, it attempts to assign the roles from that group. In this case, there are two roles defined in the group. Both are registered customer roles to be applied at the organization that owns the store to which the user is registering, but are qualified by the ancestor of the store (meaning that WebSphere Commerce only applies the role if the store is somewhere under the DN specified).
OrganizationRoles
The OrganizationRoles section is very similar to the user roles section, except that this is where the roles for new organizations are defined. The main difference is that the roles listed within the role groups for organizations are defined by name only; that is, once WebSphere Commerce locates a matching role group, it simply creates all roles defined in the list.
The following is an example for OrganizationRoles:
<Organization registrationType="ResellerRegistration" memberAncestor="o=Supplier Organization,o=Root Organization" storeAncestor="o=Root Organization"> <Role name="Seller"/> <Role name="Category Manager"/> <Role name="Logistics Manager"/> <Role name="Marketing Manager"/> <Role name="Sales Manager"/> <Role name="Seller Administrator"/> <Role name="Registered Customer"/> </Organization>
This example shows that if an organization that matches on the outer criteria (registrationType, memberAncestor, and storeAncestor) is created, then all of the roles listed will be created for that organization.
BusinessEntities
The BusinessEntities section follows the same structure as the OrganizationRoles section, and is used to list the organizations that act as business entities in the system.
The following is an example for BusinessEntities:
<BusinessEntities> <Organization registrationType="" memberAncestor="o=Supplier Organization,o=Root Organization" storeAncestor="o=Root Organization"/> </BusinessEntities>
Note that roles are not defined in the BusinessEntities section, and this section is used simply to list organizations.
RegistrationParents
The last section is the RegistrationParents section. This is where WebSphere Commerce defines the parent organization for new users and organizations. Although many of the WebSphere Commerce commands will still allow the programmatic assignment of parent, certain business models require that the parent be fixed. IF this is the case, WebSphere Commerce fixes the parents in this file.
The following is an example for RegistrationParents:
<RegistrationParents> <Organization registrationType="ResellerRegistration" memberAncestor="o=Supplier Organization,o=Root Organization" storeAncestor="ou=Supplier Hub Organization,o=Supply Chain Management Organization,o=Root Organization"/> </RegistrationParents>