Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limits to license and enforce Project limit #947

Merged
merged 6 commits into from
Sep 8, 2022
Merged

Conversation

knolleary
Copy link
Member

@knolleary knolleary commented Sep 6, 2022

Closes #776 #780

This PR builds on #946 - that should get merged first.

This adds claims to the license to cover projects, users, teams and devices.

If no license is applied (CE edition), they default to the values described in #780

If a license is applied, it uses the values from the license, defaulting to 0 if not present.

When the platform starts up, it reports on the counts:

[2022-09-06T18:45:57.482Z] INFO: License verified:
[2022-09-06T18:45:57.482Z] INFO:   ****************************
[2022-09-06T18:45:57.482Z] INFO:   * Development-mode License *
[2022-09-06T18:45:57.482Z] INFO:   ****************************
[2022-09-06T18:45:57.482Z] INFO:  Org:     FlowForge Inc. Development
[2022-09-06T18:45:57.482Z] INFO:  Valid From : 2022-09-06T00:00:00.000Z
[2022-09-06T18:45:57.482Z] INFO:  Expires    : 2223-02-04T23:59:59.000Z
[2022-09-06T18:45:57.491Z] INFO: Usage:
[2022-09-06T18:45:57.491Z] INFO:  Users    : 3/150
[2022-09-06T18:45:57.491Z] INFO:  Teams    : 3/50
[2022-09-06T18:45:57.491Z] INFO:  Projects : 5/50
[2022-09-06T18:45:57.492Z] INFO:  Devices  : 4/50

In the second commit, changes are added to enforce the Project limit. This is done as a hook on the model itself - so any code path that tries to create a project in the database will be handled.

The UI side does a fairly default Alert notification that the license limit has been reached. That can be refined as I work through policing the other limits.

NOTE TO DEVELOPERS

Once this PR is merged, you will need to update the development license you are running with locally otherwise you will no longer be able to create projects (unless you run with no license at all). As before, this is provided in forge/licensing/index.js.

@knolleary
Copy link
Member Author

Just noticed the UI tests are failing - am investigating

@knolleary
Copy link
Member Author

Ah - the test attempts to invite a 4th user to a team. Which is not possible anymore due to the new limits.

@Steve-Mcl
Copy link
Contributor

Kinda proves it works. :)

@knolleary
Copy link
Member Author

Reordered the test a bit so that it never tries to exceed the team membership limit.

@knolleary knolleary merged commit 95a8f10 into main Sep 8, 2022
@knolleary knolleary deleted the license-limits branch September 8, 2022 11:22
@knolleary knolleary linked an issue Sep 8, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Community Edition license defaults License limits number of Projects on the platform
2 participants