//--- Constructors --- public SeatingBL(IUserBL userBL, ILicenseBL licenseBL, ICurrentUserContext userContext, IDekiDataSession dataSession, ILog log) { _userBL = userBL; _licenseBL = licenseBL; _log = log; _userContext = userContext; _dataSession = dataSession; }
//--- Constructors --- public LicenseManager(ILicenseController licenseController, IUserBL userBL, LicenseData licenseData, ILicenseBL licenseBL, IInstanceSettings settings, ISeatingBL seatingBL, LicenseStateTransitionCallback licenseStateTransitionCallback) { _licenseController = licenseController; _userBL = userBL; _licenseData = licenseData; _licenseBL = licenseBL; _settings = settings; _seatingBL = seatingBL; _licenseStateTransitionCallback = licenseStateTransitionCallback; }
public override LicenseData VerifyLicenseData(LicenseData licenseData, ILicenseBL licenseBL, ISeatingBL seatingBL) { _log.Debug("verifying license: " + licenseData.LicenseState); // load authoritative license from remote var license = LicenseDoc; var verified = licenseBL.DetermineLicenseState(new LicenseData().WithLicenseDocument(license), true, seatingBL.IsSeatLicensingEnabled(licenseData)); if(!(new[] { LicenseStateType.COMMERCIAL, LicenseStateType.TRIAL, LicenseStateType.INACTIVE, LicenseStateType.EXPIRED }).Contains(verified.LicenseState)) { _log.DebugFormat("license state '{0}' is not allowed for remotely managed instances", verified.LicenseState); throw new MindTouchRemoteLicenseFailedException(); } _log.Debug("verified license: " + verified.LicenseState); return verified; }
public override LicenseData VerifyLicenseData(LicenseData licenseData, ILicenseBL licenseBL, ISeatingBL seatingBL) { _log.Debug("verifying license: " + licenseData.LicenseState); // load authoritative license from remote var license = LicenseDoc; var verified = licenseBL.DetermineLicenseState(new LicenseData().WithLicenseDocument(license), true, seatingBL.IsSeatLicensingEnabled(licenseData)); if (!(new[] { LicenseStateType.COMMERCIAL, LicenseStateType.TRIAL, LicenseStateType.INACTIVE, LicenseStateType.EXPIRED }).Contains(verified.LicenseState)) { _log.DebugFormat("license state '{0}' is not allowed for remotely managed instances", verified.LicenseState); throw new MindTouchRemoteLicenseFailedException(); } _log.Debug("verified license: " + verified.LicenseState); return(verified); }
//--- Methods --- public virtual LicenseData UpdateLicense(XDoc license, LicenseData currentLicense, ILicenseBL licenseBL, ISeatingBL seatingBL) { licenseBL.Validate(license); // Only site owner of a license can upload a license that has seat licensing enabled. seatingBL.ValidateLicenseUpdateUser(license); var newLicense = HandleLicenseTransition(license, currentLicense, seatingBL, licenseBL); _licenseStoragePlug.At(_wikiId, LICENSE_FILE).Put(license); return newLicense; }
protected LicenseData HandleLicenseTransition(XDoc licenseDoc, LicenseData currentLicense, ISeatingBL seatingBL, ILicenseBL licenseBL) { var seatingEnabledInNewLicense = seatingBL.IsSeatLicensingEnabled(licenseDoc); var tempLicense = licenseBL.BuildLicenseData(licenseDoc, true, seatingEnabledInNewLicense); var newLicense = licenseBL.ValidateNewLicenseTransition(tempLicense, currentLicense); _log.DebugFormat("new license with state '{0}' has passed validation and will be accepted", newLicense.LicenseState); // Ensure that all seats are cleared if seat licensing is disabled. // This will allow a known clean seat state if it becomes enabled. if(!seatingBL.IsSeatLicensingEnabled(currentLicense)) { _log.Debug("old license did not have seat licensing"); seatingBL.RevokeSeats(currentLicense); } // Seat licensing if(seatingEnabledInNewLicense) { var seats = seatingBL.HandleSeatTransition(licenseDoc); if(seats.Assigned > seats.Allowed) { HandleExcessSeats(currentLicense, seatingBL, seats); } // set a seat for the owner seatingBL.SetOwnerUserSeat(newLicense); } else { _log.Debug("new license does not contain seat licensing"); // Clear the seat state when going to non-seat license seatingBL.RevokeSeats(newLicense); } _log.DebugFormat("transitioned license from '{0}' to '{1}'", currentLicense.LicenseState, newLicense.LicenseState); return newLicense; }
public virtual LicenseData VerifyLicenseData(LicenseData licenseData, ILicenseBL licenseBL, ISeatingBL seatingBL) { if(licenseData.LicenseDoc.IsEmpty) { licenseData = licenseData.WithLicenseDocument(LicenseDoc); } return licenseBL.DetermineLicenseState(licenseData, true, seatingBL.IsSeatLicensingEnabled(licenseData)); }
public LicenseService(ILicenseBL licenseBL) { _licenseBL = licenseBL; }
//--- Methods --- public override LicenseData UpdateLicense(XDoc license, LicenseData currentLicense, ILicenseBL licenseBL, ISeatingBL seatingBL) { _log.DebugFormat("updating license from '{1}' to '{0}'", license["@type"].Contents, currentLicense.LicenseState); licenseBL.Validate(license); return HandleLicenseTransition(license, currentLicense, seatingBL, licenseBL); }
//--- Methods --- public override LicenseData UpdateLicense(XDoc license, LicenseData currentLicense, ILicenseBL licenseBL, ISeatingBL seatingBL) { _log.DebugFormat("updating license from '{1}' to '{0}'", license["@type"].Contents, currentLicense.LicenseState); licenseBL.Validate(license); return(HandleLicenseTransition(license, currentLicense, seatingBL, licenseBL)); }