Skip to content

Commit

Permalink
Merge pull request #18 from cryptlex/muneeb/set-permission-flags
Browse files Browse the repository at this point in the history
feat: Add SetPermissionFlag() function to LexFloatClient and LexFloatClientNative classes
  • Loading branch information
ahmad-kemsan authored Aug 6, 2024
2 parents b9e620e + c69884d commit 2970a40
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,28 @@ public static void SetHostUrl(String hostUrl) throws LexFloatClientException {
}
}

/**
* 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.
*
* @param flag depending on your application's requirements, choose one of
* the following values: LF_USER, LF_ALL_USERS.
* <ul>
* <li> LF_USER: This flag indicates that the application does not require admin or root permissions to run.</li>
* <li> LF_ALL_USERS: This flag is specifically designed for Windows and should be used for system-wide activations.</li>
* </ul>
* @throws LexFloatClientException
*/
public static void SetPermissionFlag(int flag) throws LexFloatClientException {
int status;
status = LexFloatClientNative.SetPermissionFlag(flag)

if (LF_OK != status) {
throw new LexFloatClientException(status);
}
}

/**
* Sets the renew license callback function.<br>
* Whenever the license lease is about to expire, a renew request is sent to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class LexFloatClientNative implements Library {
public interface CallbackType extends Callback {
void invoke(int status);
}
/* Permission Flags */
public static final int LF_USER = 10;
public static final int LF_ALL_USERS = 11;

public static native int SetHostProductId(String productId);

Expand All @@ -29,6 +32,8 @@ public interface CallbackType extends Callback {

public static native int SetHostUrl(WString hostUrl);

public static native int SetPermissionFlag(int flags);

public static native int SetFloatingLicenseCallback(CallbackType callback);

public static native int SetFloatingClientMetadata(String key, String value);
Expand Down

0 comments on commit 2970a40

Please sign in to comment.