Skip to content

Commit decfe79

Browse files
committed
feat: add permission flag
1 parent 6f28501 commit decfe79

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

cryptlex/lexfloatclient/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException
1+
from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException, PermissionFlags

cryptlex/lexfloatclient/lexfloatclient.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
callback_list = []
77

8+
class PermissionFlags:
9+
LF_USER = 10
10+
LF_ALL_USERS = 11
811

912
class HostLicenseMeterAttribute(object):
1013
def __init__(self, name, allowed_uses, total_uses, gross_uses):
@@ -278,6 +281,30 @@ def RequestFloatingLicense():
278281
if LexFloatStatusCodes.LF_OK != status:
279282
raise LexFloatClientException(status)
280283

284+
@staticmethod
285+
def SetPermissionFlag(flags):
286+
"""Sets the permission flags.
287+
288+
This function must be called on every start of your program after SetHostProductId()
289+
function in case the application allows borrowing of licenses or system wide activation.
290+
291+
Args:
292+
flags : depending on your application's requirements, choose one of
293+
the following values: LF_USER, LF_ALL_USERS.
294+
295+
LF_USER: This flag indicates that the application does not require
296+
admin or root permissions to run.
297+
298+
LF_ALL_USERS: This flag is specifically designed for Windows and should be used
299+
for system-wide activations.
300+
301+
Raises:
302+
LexFloatClientException
303+
"""
304+
status = LexFloatClientNative.SetPermissionFlag(flags)
305+
if LexFloatStatusCodes.LF_OK != status:
306+
raise LexFloatClientException(status)
307+
281308
@staticmethod
282309
def DropFloatingLicense():
283310
"""Sends the request to the LexFloatServer to free the license.

cryptlex/lexfloatclient/lexfloatclient_native.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ def byte_to_string(input):
163163
RequestFloatingLicense.argtypes = []
164164
RequestFloatingLicense.restype = c_int
165165

166+
SetPermissionFlag = library.SetPermissionFlag
167+
SetPermissionFlag.argtypes = [c_uint32]
168+
SetPermissionFlag.restype = c_int
169+
166170
DropFloatingLicense = library.DropFloatingLicense
167171
DropFloatingLicense.argtypes = []
168172
DropFloatingLicense.restype = c_int

0 commit comments

Comments
 (0)