License management? Get license info...

Questions, tips and tricks and techniques for scripting in Servoy

License management? Get license info...

Postby joe26 » Sat Sep 19, 2015 12:25 am

Is there a call to get the remaining licenses from Servoy when running the web client?

I can tell through UserManager that a specific application is running, whether login, App1 and App2. (Servoy 7.0)

I _could_ set preferences, but it would be better to be able to retrieve that Information from Servoy.

Is there such a beast?

Thanks,
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

Re: License management? Get license info...

Postby patrick » Sat Sep 19, 2015 2:09 pm

You have application.getClientCountForInfo(). On login, you could set that info (via application.addClientInfo) to the solution name for example and then call that.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: License management? Get license info...

Postby joe26 » Mon Sep 21, 2015 10:31 pm

I am seeking the total available clients under the Servoy license, not the active licenses, as shown under

http://10.8.0.1:8080/servoy-admin/license

License Information

You currently have 55 valid licenses, which allows 55 clients to connect.


Thanks,
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

Re: License management? Get license info...

Postby mboegem » Mon Sep 21, 2015 11:44 pm

Hi Joe,

licenses are stored in the servoy.properties file.
The UserManager plugin is able to read the properties file.
An easy way is to iterate all the properties and read the ones that you need to have (ie. license.0.licenses)

Another way would be to read the number of licensekeys in the manager (licenseManager.numberOfLicenses)
Then iterate the license.0.licenses, license.1.licenses etc.

Code: Select all
function license_count() {
   var _nTotal = 0;
   var _nCount = parseInt(plugins.UserManager.getSettingsProperty('licenseManager.numberOfLicenses'), 10);
   if(_nCount) {
      for (var i = 0; i < _nCount; i++) {
         _nTotal += parseInt(plugins.UserManager.getSettingsProperty('license.' + i + '.licenses'), 10);
      }
   }
   
   return _nTotal;
}


Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: License management? Get license info...

Postby joe26 » Tue Sep 22, 2015 6:25 pm

Thank You, Marc! This fit the bill!

It would have taken me many iterations to get to the license information, and even considered getting it directly (password and all) from the server URL... Every day is a new day, and a new challenge.

Thanks,
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

Re: License management? Get license info...

Postby mboegem » Tue Sep 22, 2015 7:13 pm

Glad that works for you!
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to Methods

Who is online

Users browsing this forum: No registered users and 11 guests