addEntitlement( Name, Description [, URL ] )
- Name: Code (provided by eSignal) or fully qualified URL to lookup file.
- Description: Text to be displayed to user if they are not entitled.
- URL: URL to jump to if user clicks on Description.
addEntitlement("http://www.mysite.com//authorizedusers.txt", "Sorry. You are not authorized to use this script.","http://www.mysite.com//HowToRegister.htm" );
The addEntitlement() function was fully exposed as of the 7.5 Gold release. It provides script developers with the ability to quickly activate or de-activate scripts for paying customers. With this functionality, you can encrypt and distribute a single copy of a particular script and only authorized users will be able to run that script.
The process is simple. Create a text file with the eSignal usernames of all users who are authorized to use your script and place this text file on your web site or in a private group in the eSignal File Share. Usernames should be entered one per line. Place the addEntitlement() function in preMain() and include the fully qualified URL to the location of the authorization text file. The final step is to encrypt the script. As users purchase/lease your scripts, you can add their eSignal username to the centrally-located authorization file. Deactivating a user is as simple as removing their eSignal username from the same file.
When a user loads a script that includes the addEntitlement() function, the file specified in the Name parameter will be accessed. If the current user's eSignal username is found in the list, the script will function normally. If the username is not found in the list of authorized users, the text specified in the Description parameter will be displayed to the user and the script will be halted. If the URL parameter is used, the user can double-click on the text that is displayed and their browser will be opened to the specified URL.
- If you experience intermittent problems with the entitlement, check your URL string for the user names text file and replace any single forward slashes with double forward slashes as in the example above.
- If you are using the addEntitlement() function then it follows that you will also be encrypting your script. If you want to hide the little lock symbol that appears next to the title of an encrypted script, add the following function call to your preMain() function: setProperty( "HideEncryptedLock", "yes" );