Skip to content

Commit

Permalink
CB-4773 show license validation error (#2423)
Browse files Browse the repository at this point in the history
Co-authored-by: Daria Marutkina <[email protected]>
  • Loading branch information
alexander-skoblikov and dariamarutkina authored Feb 28, 2024
1 parent ac75405 commit 9fe091d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,11 @@ public boolean isLicenseValid() {
return false;
}

@Nullable
public String getLicenseStatus() {
return null;
}

/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,13 @@ private void checkActionPermissions(@NotNull Method method, @NotNull WebAction w
// Check license
if (application.isLicenseRequired() && !application.isLicenseValid()) {
if (!ArrayUtils.contains(reqPermissions, DBWConstants.PERMISSION_ADMIN)) {
String errorMessage = "Invalid server license";
String licenseStatus = application.getLicenseStatus();
if (licenseStatus != null) {
errorMessage = errorMessage + ": " + licenseStatus;
}
// Only admin permissions are allowed
throw new DBWebExceptionLicenseRequired("Invalid server license");
throw new DBWebExceptionLicenseRequired(errorMessage);
}
}
// Check permissions
Expand Down

0 comments on commit 9fe091d

Please sign in to comment.