Closed infeo closed 2 months ago
The update involves enhancing license management and enforcement in a software system. Changes were made to accurately track and control the number of licensed seats, improve the license status reporting, and ensure that vault creation adheres to license limits. These adjustments are aimed at ensuring compliance with licensing terms, enhancing user experience by providing clear feedback on license status, and preventing unauthorized use of software features beyond the licensed capacity.
Files | Change Summary |
---|---|
.../api/LicenseResource.java |
Introduced LicenseResource class for license status endpoints with related functionality. |
.../license/LicenseHolder.java |
Enhanced logging and method visibility for testing in LicenseHolder . |
.../api/BillingResourceTest.java |
Updated test to reflect changes in getSeats() return value. |
frontend/src/common/backend.ts |
Added LicenseUserInfoDto and LicenseService for license user information retrieval. |
frontend/src/components/LicenseAlert.vue |
Updated functionality to use license object for license-related checks and data retrieval. |
frontend/src/components/VaultList.vue |
Modified UI logic for license alerts and integrated licenseStatus fetching. |
Objective | Addressed | Explanation |
---|---|---|
Prevent vault creation if license exceeded (#262) | ✅ | |
Allow vault creation flow start but stop with error if license limit surpassed (#262) | ✅ | |
Prevent vault creation on returning to vault list after license exceedance error (#262) | ✅ | |
Check license compliance during vault creation to prevent recovery key display (#262) | ✅ | |
Address unexpected vault creation despite license exceedance error (#262) | ✅ |
In the code where licenses dwell,
A rabbit worked, its magic spell.
🐇💻 With every line and clever tweak,
Ensured the software's not for the meek.
"No vaults too many," it declared with cheer,
For rules are rules, let's make that clear!"
🌟 With every commit, pushed with might,
Ensured the license stood just right.
frontend/src/components/LicenseAlert.vue (2)
`2-2`: Ensure that the condition for displaying the license expiration alert is robust and correctly handles potential null values in `license.expiresAt`.Verification successful
--- The verification process confirms that the condition `license?.expiresAt && now > license.expiresAt` in `LicenseAlert.vue` is the only instance where the `license?.expiresAt` property is used. This condition correctly handles potential null values by using optional chaining (`?.`), which safely accesses `expiresAt` only if `license` is not null. Therefore, the implementation is robust as per the requirements specified in the review comment.--- `39-52`: Ensure proper error handling in the `fetchData` function. Consider displaying a user-friendly message or UI element when fetching license information fails. Consider enhancing the user experience by providing feedback in the UI when an error occurs during the fetching of license information.Scripts Executed
The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify that the license object always has the expiresAt property when it is used. ast-grep --lang javascript --pattern $'license?.expiresAt' ``` Length of output: 59 --- --- Script: ```shell #!/bin/bash # Search for textual occurrences of 'license?.expiresAt' in JavaScript files to ensure all usages are captured. rg 'license\?.expiresAt' --glob '*.vue' --glob '*.js' ``` Length of output: 195frontend/src/components/VaultList.vue (3)
`11-11`: Ensure that the `isLicenseSuspicious` computed property is correctly implemented to reflect the intended license checks.Verification successful
--- The `isLicenseSuspicious` computed property is indeed implemented in the `VaultList.vue` file. The ripgrep output shows that this property is used within a `` component and a ` ` component, and it is defined as a computed property. This confirms that the property is actively used to control UI elements based on the license status, aligning with the intended functionality described in the review comment. **Conclusion: The `isLicenseSuspicious` computed property is correctly implemented in the `VaultList.vue` file to reflect the intended license checks.** --- `43-43`: Review the implementation of the disabled state for the `MenuButton` to ensure it is correctly tied to the `isLicenseSuspicious` flag. --- `140-153`: > :memo: **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [124-191] Ensure robust error handling and user feedback mechanisms are in place for the `fetchData` function, especially considering its critical role in fetching and handling license information. Consider implementing more comprehensive error handling and user feedback in the `fetchData` function to enhance reliability and user experience.Scripts Executed
The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify the implementation of isLicenseSuspicious to ensure it correctly uses licenseStatus properties. ast-grep --lang javascript --pattern $'isLicenseSuspicious' ``` Length of output: 58 --- --- Script: ```shell #!/bin/bash # Adjusting the search pattern to find `isLicenseSuspicious` within a computed properties block in Vue components ast-grep --lang javascript --pattern $'computed { $$$ isLicenseSuspicious { $$$ } $$$ }' ``` Length of output: 560 --- --- Script: ```shell #!/bin/bash # Simplifying the search pattern to find `isLicenseSuspicious` in any context within JavaScript files ast-grep --lang javascript --pattern $'isLicenseSuspicious { $$$ }' ``` Length of output: 518 --- --- Script: ```shell #!/bin/bash # Using ripgrep to search for 'isLicenseSuspicious' in Vue component files to ensure it is defined and implemented correctly rg 'isLicenseSuspicious' --glob '*.vue' ``` Length of output: 586
Another thing I noticed: in https://github.com/cryptomator/hub/blob/feature/license-status-endpoint/frontend/src/components/LicenseAlert.vue we still use the billing resource, which means that still only admins see this alert, do we want to adjust this in a separate PR or in this one?
means that still only admins see this alert, do we want to adjust this in a separate PR or in this one?
I changed it in fedd8de23e1a1f918e42a319c2c5dc5cfe814b5d
Fixes #262.
This PR adds the new REST endpoint
/license
.This endpoint is intended to give information about the license set in the hub instance. Currently, this endpoint does not have any direct actions, but only a subresource
/license/user-info
. This is intentional, because the longterm goal is to move the/billing
endpoint to/license
.The subresource
/license/user-info
is intended for any user to get necessary information about the license like expiration date and licensed seats.Remark: The license endpoint could also be used in the
VaultDetails
vue component, but due to a required refactoring there it is not used.Summary by CodeRabbit
New Features
LicenseResource
class to provide endpoints for retrieving license status information.LicenseStatusDto
andLicenseService
in the frontend to support license status checks and display.LicenseAlert
based on license status.Bug Fixes
Refactor
LicenseHolder
.Style
MenuButton
attributes inVaultList.vue
for better user interaction based on license status.