Main principles of badge management

A badge is a code that is linked with the license management. It corresponds to a kind of resource that has a stock which is consumed by users when using the functions of Sage X3.
For instance, a badge called ERPDIS (ERP - distribution) has been defined by Sage to control
the distribution functions of Sage X3

Definition of badges

Badge codes are defined in policy files. Policy files are signed JSON files that are installed on an installation to define what are the resources protected by the license. A license always refers to a given policy file.

At least a standard policy file is necessary to run the system, and is supplied by Sage for a given version of a software. This policy file defines different badges codes.

For instance, the following standard badges have been defined for Sage X3 version V12:
- ERPDEV (Developer)
- ERPDIS (Operation User - Distribution)
- ERPFIN (Operation User - Finance)
- ERPFULL (Full User)
- ERPMAN (Operation User -Manufacturing)
- ERPTRAN (Transactional User)

The partners that are able to deliver vertical solutions can supply additional policy files for their vertical products and therefore define vertical badges. The installation of an additional policy file is done by drag and drop of a policy file or copy and paste of the content of such a policy file in the license entity.

The list of badges included in the different policy files installed on a given installation is found in badge management.

A badge is a ticket that controls the access to a list of functions of a product. The functions are listed in the badge definition.
For instance, in version 7.1 of  Sage X3:
- ERPFULL controls the access to BUDAPP, CPTQUIT, GESPIH, FUNAUTINVC, GESROU (among many other functions)
- ERPFIN controls the access to BUDAPP, CPTQUIT, GESPIH... by not FUNAUTINVC nor GESROU
- ERPDIS controls the access to FUNAUTINVC, FUNAUTINVD, GESPIH... but not BUDAPP nor GESROU

Assign a stock of badges

Quantities are assigned to badges codes in a [license file](../administration-reference/supervisor-license-visualization.md). A license file is always associated to a policy file. This means that assigning quantities to standard badges can be done with a standard license file supplied by Sage, and assigning quantity to vertical badges can be done in a vertical license supplied by the vertical partner that delivered the corresponding policy file.
For instance, a standard license file could assign the following quantities:
- 3 ERPDEV
- 10 ERPDIS
- 12 ERPFIN
- 3 ERPFULL
Any badge not listed in the license file will have an assigned quantity equal to 0.

Consuming the badges

A role is linked to a list of badges. The definition of the roles and the assignment of badges to the role is defined freely by the administrator of user management.

According to the groups a user belongs to, he can connect with different roles, but only one role can be selected at a time, (this is done in the user preference panel), and by default, the role used at the last connection time will be selected.

When a user selects a role, he consumes a quantity of 1 for every badge associated to the role. If there is no more available stock for at least one of the badges associated to the role, the role cannot not be selected. Successfully changing the role will release the badges consumed by the previous role.

If a role has no badge associated to a given product, a message telling that no badge has been selected for the product X will be displayed, and only the administration functions will appear in the navigation page.

If a function requires a badge not associated to the current role of the user, entering on the corresponding page will not be possible (the message XXXXX: access prohibited by the licence will be displayed).

Example

With the definition given before:
- a user willing to use the GESPIH (purchase invoices) function will need to consume either
  an ERPFIN, an ERPDIS or an ERPFULL badge.
- to use the BUDAPP (budget approval) function, consuming an ERPFIN or ERPDIS badge is necessary.
- to use the FUNAUTINVC function (contracts automatic invoicing), consuming an ERPFULL or ERPDIS
  badge is necessary.
Let's imagine we have a stock of 10 ERPDIS, 12 ERPFIN, 3 ERPFULL.
The following roles have been defined by the administrator of the users:
- ACCOUNTANT (associated to ERPFIN)
- SALESMAN (associated to ERPDIS)
- CFO (associated to ERPDIS and ERPFIN)
- BIGBOSS (associated to ERPFULL)
- REDUNDANT (associated to ERPDIS and ERPFULL)
For the differents users, the situation can be the following:
- A user MARTIN willing to access to the function GESROU (routings) can only use BIGBOSS
  as a role (because it is the only role that is associated to ERPFULL)
- A user JOHN willing to access to the functions GESPIH (purchase invoices) can use
  any role defined previously.
- A user LAWRENCE willing to access to BUDAPP can use the role ACCOUNTANT, CFO, or BIGBOSS.
   But if he doesn't need to access to distribution or manufacturing function, using the role
   ACCOUNTANT will be preferable to spare badges consumption.
- A user DOE decides to using the role REDUNDANT. This is not very adequate, because he will
  consume two badges instead of one, and he can use only one because the badge ERPFULL gives
  access to all the functions associated to ERPDIS.
- If 10 users are already connected at a given moment with ACCOUNTANT role, the only way for
  an 11th user to have access to BUDAPP function is to select the role BIGBOSS that will
  consume an ERPFULL badge. This will only be possible if we have less than 3 people already
  connected with a role that consumes an ERPFULL badge.

Appendix

A developer has access to different methods in the context to control what the license grants to the current user. The corresponding documentation is defined here.

There is no direct method that gives access to the stock of badges, but there is a method that returns if a user has granted a license access to a given function (ie. if the badges he consumes with the current role allows to use the function).