Skip to content

Commit

Permalink
feat: add permission flag
Browse files Browse the repository at this point in the history
  • Loading branch information
muneebkq committed Jul 8, 2024
1 parent 6f28501 commit decfe79
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cryptlex/lexfloatclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException
from cryptlex.lexfloatclient.lexfloatclient import LexFloatClient, LexFloatStatusCodes, LexFloatClientException, PermissionFlags
27 changes: 27 additions & 0 deletions cryptlex/lexfloatclient/lexfloatclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -278,6 +281,30 @@ def RequestFloatingLicense():
if LexFloatStatusCodes.LF_OK != status:
raise LexFloatClientException(status)

@staticmethod
def SetPermissionFlag(flags):
"""Sets the permission flags.
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(flags)
if LexFloatStatusCodes.LF_OK != status:
raise LexFloatClientException(status)

@staticmethod
def DropFloatingLicense():
"""Sends the request to the LexFloatServer to free the license.
Expand Down
4 changes: 4 additions & 0 deletions cryptlex/lexfloatclient/lexfloatclient_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit decfe79

Please sign in to comment.