QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
103 lines
5.1 KiB
Markdown
103 lines
5.1 KiB
Markdown
# How does our licensing work?
|
|
|
|
## What is a license?
|
|
Our licenses are just simple GUIDs.
|
|
|
|
There is a GUID for `c-entron.NET`, another one for `Service-Board`, and again a different one for `Outlook Add-In`, etc.
|
|
But also **single features** can have their own GUID.
|
|
For example the `branch functionality`, or the `report server`, etc.
|
|
|
|
Those are all licenses a customer can potentially **have** or **NOT have**.
|
|
Additionally, each license can have a `count`, a `valid until date` and a `valid until version`, with either a `real value` or `unlimited`.
|
|
The license also has a name for display purposes only, technically the name is not relevant at all.
|
|
|
|
So, to summarize it again, for each license we have the following possible values:
|
|
* Does he have the license (`GUID`)?
|
|
* How many of them (`count`)?
|
|
* Until when is this license valid (`valid until date`)?
|
|
* Until which version is the license valid (`valid until version`)?
|
|
|
|
## How does the c-entron.NET and c-entron Web-Service work with those?
|
|
The c-entron.NET and c-entron Web-Service (also Riverbird Web-Service) generally differentiate between `Applications` and `Only Licenses`.
|
|
|
|
`Only Licenses` are the **single features** like the `branch functionality` or the `report server`.
|
|
They are all listed in the `LicenseGuids.cs` file.
|
|
Actually, every single license that we have is listed in the `LicenseGuids.cs` file, no matter if it's just a single license that we check for, or a `Application`.
|
|
|
|
`Applications` on the other hand are all licenses that are allowed to `Login` at the web-service.
|
|
They are all listed in the `ApplicationKind.cs` file.
|
|
Every entry in that file is allowed to `Login` at the web-service.
|
|
For all of those the `count`, `valid until date` and `valid until version` values are automatically checked and validated.
|
|
|
|
## Which licenses do we have?
|
|
The single source of truth for all our available licenses is the license-server.
|
|
You can use the `c-entron Office` tool to look at all the licenses, but usually that is not required.
|
|
We try to keep the `LicenseGuids.cs` file in sync with the license-server, to make it easier to check for licenses.
|
|
|
|
## I need a new license, what do I do?
|
|
At first, make sure we really have a `NEW THING` that needs to be separately licensed?
|
|
|
|
When you're sure, go to your development leader of your choice, and ask him to create this new license for you.
|
|
He will give you the `GUID` that represents this license.
|
|
Remember: Our licenses are just simple GUIDs.
|
|
|
|
You should add this new GUID to the `LicenseGuids.cs` file. And if it's required to `Login` at the web-service with it (in case for a new product), also add it to the `ApplicationKind.cs` file.
|
|
|
|
## Great, I got the GUID, how do I check for the license now?
|
|
If your license is a `Application` like we talked about above, then you might not need to do anything.
|
|
Just adding it the the `ApplicationKind.cs` is enough to allow you to login at the web-service, and have the `count`, `valid until date` and `valid until version` validated for you.
|
|
|
|
If you only have a simple boring license that you want to check, to show or hide a module in the c-entron.NET (like the `password manager` for example), or show some UI to the user, or enable extra functionality in any other way, you can use the `LicenseManager` to do that.
|
|
|
|
Let me just show you some code examples.
|
|
|
|
### Check if the customer has a license
|
|
|
|
Again, you can use this to hide or show UI, a module, or enable some features for a customer only.
|
|
|
|
```csharp
|
|
bool hasPasswordManager = LicenseManager.Instance.HasLicense(LicenseGuids.PasswordManager); // This is the important line
|
|
|
|
if (hasPasswordManager)
|
|
this.ShowPasswordManagerUI();
|
|
```
|
|
|
|
### Check the `count` of the license
|
|
|
|
This can for example be used, when we license something on a HOW MANY base.
|
|
|
|
Right now we do it for example for the `MyDay Import`.
|
|
This module can be used to import from external tools into c-entron for the `MyDay` module.
|
|
And we sell every import separately.
|
|
That means, a customer could buy 3 imports, and then would be allowed to configure 3 different imports.
|
|
|
|
On a more crazy, made up example, we could use this functionality to license how many articles the customer is allowed to create in the c-entron.
|
|
|
|
```csharp
|
|
Result<int?> myDayImportCountResult = LicenseManager.Instance.GetLicenseCount(LicenseGuids.MyDayImports); // This is the important line
|
|
|
|
if (myDayImportCountResult.Status == ResultStatus.Error)
|
|
{
|
|
// The customer does NOT have a license for LicenseGuids.MyDayImports
|
|
// Consider checking with LicenseManager.Instance.HasLicense first if the customer even has the license
|
|
}
|
|
else if (myDayImportCountResult.Status == ResultStatus.Success)
|
|
{
|
|
// The customer does have a license for LicenseGuids.MyDayImports, that's great!
|
|
// Lets now check how MANY of them he does have
|
|
// Again, this checks the COUNT of the license
|
|
int? licenseCount = myDayImportCountResult.Data;
|
|
|
|
if (licenseCount == null)
|
|
{
|
|
// The COUNT is UNLIMITED
|
|
}
|
|
else
|
|
{
|
|
// The COUNT is the number that is in licenseCount right now
|
|
// If the customer is allowed to use 3 MyDayImports, then licenseCount would be 3 here
|
|
}
|
|
}
|
|
```
|
|
|