LicenseRedistributionService class
This functionality is available for Creatio 8.1.3 and later.
Terrasoft.Configuration.CrtUIv2 namespace.
The Terrasoft.Configuration.CrtUIv2.ILicenseRedistributionService class provides programmatic, server-side control over license redistribution. Use this class to redistribute licenses as part of advanced automation and integration scenarios, for example when you need to:
- Automate role-based license redistribution for new and existing users.
- Apply complex or conditional business rules.
- Process large user groups efficiently.
- Integrate license redistribution with external systems or custom components.
The class uses the same license redistribution logic as manual redistribution and business process-based redistribution. Learn more: Automate role-based license redistribution.
Before using the LicenseRedistributionService class in custom business logic, retrieve a class instance through dependency injection using the ILicenseRedistributionService interface as follows.
var licenseService = ClassFactory.Get<ILicenseRedistributionService>();
Methods
RedistributeLicences(
bool redistributeManuallyAssignedLicences
)
Redistribute licenses for all active users.
Parameters
bool redistributeManuallyAssignedLicences | Whether to recalculate manually granted licenses. By default, "false." true All licenses are recalculated, including overriding manually granted licenses based on role priority. Use when a full license recalculation is required. false Manually granted licenses remain unchanged. Recommended for most scenarios to preserve administrator adjustments. |
RedistributeLicencesForRole(
bool redistributeManuallyAssignedLicences,
Guid roleId
)
Redistribute licenses for a specific user role.
Parameters
bool redistributeManuallyAssignedLicences | Whether to recalculate manually granted licenses. By default, "false." true All licenses are recalculated, including overriding manually granted licenses based on role priority. Use this value when a full license recalculation is required for the role. false Manually granted licenses remain unchanged. Recommended for most scenarios to keep administrator adjustments unchanged. | ||||
Guid roleId | ID of the user role whose licenses are redistributed. |
RedistributeLicencesForUser(
Guid userId,
bool redistributeManuallyAssignedLicences,
bool hasManuallyAssignedLicense
)
Redistribute licenses for a single user.
Parameters
Guid userId | ID of the user whose licenses are recalculated. | ||||
bool redistributeManuallyAssignedLicences | Whether to recalculate manually granted licenses. By default, "false." true All licenses are recalculated, including overriding manually granted licenses based on role priority. Use this value when a full license recalculation is required for the user. false Manually granted licenses remain unchanged. Recommended for most scenarios to keep administrator adjustments unchanged. | ||||
bool hasManuallyAssignedLicense | Whether the user has manually granted licenses before redistribution. Creatio uses this parameter to determine how to apply license rules during redistribution. true The user has manually granted licenses in addition to role-based licenses. false The user has only role-based licenses. |