License
The context class contains a set of methods used to handle the rights granted by the license.
The main principles of license management are:
* In order to be granted the right to run the V12 platform, you must have at least a license file associated to a policy file:
* the policy file defines a set of elements which use can be controlled;
* the license file defines the authorizations granted to the user for every element listed in the policy file.
* Additional license files can be installed, for instance, to grant rights to specific or vertical extensions as well as to other product lines.
* The authorization depends on the folder as well as on the user's role operating the connection.
* A user can access the current license rights through a dedicated administration function.
* A developer has access to all these licensed elements in order to know if a given resource can be used without exceeding the granted rights.
The following table describes the context methods available
Element | Method code | Parameters | Return |
---|---|---|---|
Activity code | AGETLICACV | activity code (Char) |
|
Function | AGETLICFCT | function code (Char) |
|
Parameter kit | AGETLICKIT | parameter kit (Char) |
|
Language | AGETLICLAN | language code (Char) |
|
Legislation | AGETLICLEG | legislation code (Char) |
|
Modules | AGETLICMOD | module (Integer) |
|
Parameter values | AGETLICPAR | parameter code (Char) parameter value returned (Char) |
|
License files | AGETLICLIC | product code(Char) |
|
License files | AGETLICEXPIRED | product code(Char) |
|
Partner ID in license file | AGETLIC_PARTNERID | product code(Char) |
|
Product version in license file | AGETLIC_PRODUCTVER | product code(Char) |
|
Policy code in license file | AGETLIC_POLICYCODE | product code(Char) |
|
Policy version in license file | AGETLIC_POLICYVER | product code(Char) |
|
Serial number in license file | AGETLIC_SERIAL | product code(Char) |
|
Note: The authorization on a resource is granted if one of the following conditions is fulfilled:
* The policy file does not define the resource as controlled.
* The policy file includes a control on the resource and the license file grants the right on it.
# A Sales order related function can be called only if GESSOH is authorized by the license.If fmet this.ACTX.AGETLICFCT("GESSOH")=[V]CST_ATRUEOK=fmet this.GENERATE_SALESORDEREndif# A Serial number control can be called only if SER activity code is authorized by the license.If fmet this.ACTX.AGETLICACT("SER")=[V]CST_ATRUEGosub CONTROL_SERIAL_NUMBEREndif# Is the Spanish legislation code allowed?If fmet this.ACTX.AGETLICLEG("SPA")=[V]CST_ATRUECall IVA_SPAINEndif# Is there a valid license file for the vertical "MYV" ?# If yes, allow execution in read-only mode if expired, otherwise allow full executionIf fmet this.ACTX.AGETLICLIC("MYV")=[V]CST_ATRUEIf fmet this.ACTX.AGETLIC_EXPIRED("MYV")=[V]CST_ATRUERETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"READONLY")ElseRETURNVAL=func MYVERTICAL.FUNCTION1(PARAM,"UPDATE")EndifEndif# How many fixed assets can be created according to the license ?Local Integer OK, MAXASSETSLocal Char RET_VAL(20)OK=fmet this.ACTX.AGETLICPAR("MAXFIXEDASSETS",RET_VAL)If OK=[V]CST_ATRUEMAXASSETS=val(RET_VAL)ElseMAXASSETS=0Endif# Build a message with the characteristics of a productLocal Char MESSAGE_LICENCE(200),PROD(20)PROD="MY_VERT"MESSAGE_LICENSE="Licence #"-fmet this.ACTX.AGETLIC_SERIAL(PROD)& -"granted by"-fmet this.ACTX.AGETLIC_PARTNERID(PROD)& -"for version"-fmet this.ACTX.AGETLIC_PRODUCTVER(PROD)& -"with policy code equal to"-fmet this.ACTX.AGETLIC_POLICYCODE(PROD)& -"(rev"-fmet this.ACTX.AGETLIC_POLICYVER(PROD)+")"## Returns : Licence #314159 granted by SOFT_VERTICAL for version 2.72 with policy code equal to VERT (rev 2)## If the licence file contains the following lines:# {# "partnerId": "SOFT_VERTICAL",# "productCode": "MY_VERT",# "productVersion": "2.72",# "policyCode": "VERT",# "policyVersion": "2",# "serial": "314159"# }