diff --git a/cryptlex/lexfloatclient/__init__.py b/cryptlex/lexfloatclient/__init__.py index 2a0e3db..6d85a8c 100644 --- a/cryptlex/lexfloatclient/__init__.py +++ b/cryptlex/lexfloatclient/__init__.py @@ -1 +1 @@ -from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException +from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException, PermissionFlags diff --git a/cryptlex/lexfloatclient/lexfloatclient.py b/cryptlex/lexfloatclient/lexfloatclient.py index 13f2e2c..399b13c 100644 --- a/cryptlex/lexfloatclient/lexfloatclient.py +++ b/cryptlex/lexfloatclient/lexfloatclient.py @@ -5,6 +5,9 @@ callback_list = [] +class PermissionFlags: + LF_USER = 10 + LF_ALL_USERS = 11 class HostLicenseMeterAttribute(object): def __init__(self, name, allowed_uses, total_uses, gross_uses): @@ -278,6 +281,30 @@ def RequestFloatingLicense(): if LexFloatStatusCodes.LF_OK != status: raise LexFloatClientException(status) + @staticmethod + def SetPermissionFlag(flag): + """Sets the permission flag. + + This function must be called on every start of your program after SetHostProductId() + function in case the application allows borrowing of licenses or system wide activation. + + Args: + flags : depending on your application's requirements, choose one of + the following values: LF_USER, LF_ALL_USERS. + + LF_USER: This flag indicates that the application does not require + admin or root permissions to run. + + LF_ALL_USERS: This flag is specifically designed for Windows and should be used + for system-wide activations. + + Raises: + LexFloatClientException + """ + status = LexFloatClientNative.SetPermissionFlag(flag) + if LexFloatStatusCodes.LF_OK != status: + raise LexFloatClientException(status) + @staticmethod def DropFloatingLicense(): """Sends the request to the LexFloatServer to free the license. diff --git a/cryptlex/lexfloatclient/lexfloatclient_native.py b/cryptlex/lexfloatclient/lexfloatclient_native.py index e116d62..baaadd8 100644 --- a/cryptlex/lexfloatclient/lexfloatclient_native.py +++ b/cryptlex/lexfloatclient/lexfloatclient_native.py @@ -163,6 +163,10 @@ def byte_to_string(input): RequestFloatingLicense.argtypes = [] RequestFloatingLicense.restype = c_int +SetPermissionFlag = library.SetPermissionFlag +SetPermissionFlag.argtypes = [c_uint32] +SetPermissionFlag.restype = c_int + DropFloatingLicense = library.DropFloatingLicense DropFloatingLicense.argtypes = [] DropFloatingLicense.restype = c_int