public override void Uninstall() { WebApiCachingControllingData.Remove(); WebApiCachingUserData.Remove(); _settingService.DeleteSetting <WebApiSettings>(); base.Uninstall(); }
public override void Install() { _settingService.SaveSetting(new WebApiSettings()); _localizationService.ImportPluginResourcesFromXml(PluginDescriptor); base.Install(); WebApiCachingControllingData.Remove(); WebApiCachingUserData.Remove(); }
public override void Uninstall() { WebApiCachingControllingData.Remove(); WebApiCachingUserData.Remove(); _settingService.DeleteSetting <WebApiSettings>(); _permissionService.UninstallPermissions(new WebApiPermissionProvider()); base.Uninstall(); }
public override void Uninstall() { WebApiCachingControllingData.Remove(); WebApiCachingUserData.Remove(); _settingService.DeleteSetting <WebApiSettings>(); _permissionService.UninstallPermissions(new WebApiPermissionProvider()); _localizationService.DeleteLocaleStringResources(this.PluginDescriptor.ResourceRootKey); _localizationService.DeleteLocaleStringResources("Plugins.FriendlyName.Api.WebApi", false); base.Uninstall(); }
public override void Install() { _permissionService.InstallPermissions(new WebApiPermissionProvider()); var apiSettings = new WebApiSettings { LogUnauthorized = true, ValidMinutePeriod = WebApiGlobal.DefaultTimePeriodMinutes }; _settingService.SaveSetting <WebApiSettings>(apiSettings); _localizationService.ImportPluginResourcesFromXml(this.PluginDescriptor); base.Install(); WebApiCachingControllingData.Remove(); WebApiCachingUserData.Remove(); }
public void RemoveKeys(int customerId) { if (customerId != 0) { var data = ( from a in _genericAttributes.Table where a.EntityId == customerId && a.KeyGroup == "Customer" && a.Key == WebApiCachingUserData.Key select a).ToList(); if (data.Count > 0) { foreach (var itm in data) { _genericAttributeService.DeleteAttribute(itm); } WebApiCachingUserData.Remove(); } } }
public bool CreateKeys(int customerId) { if (customerId != 0) { var hmac = new HmacAuthentication(); var userData = WebApiCachingUserData.Data(); string key1, key2; for (int i = 0; i < 9999; ++i) { if (hmac.CreateKeys(out key1, out key2) && !userData.Exists(x => x.PublicKey.IsCaseInsensitiveEqual(key1))) { var apiUser = new WebApiUserCacheData { CustomerId = customerId, PublicKey = key1, SecretKey = key2, Enabled = true }; RemoveKeys(customerId); var attribute = new GenericAttribute { EntityId = customerId, KeyGroup = "Customer", Key = WebApiCachingUserData.Key, Value = apiUser.ToString() }; _genericAttributeService.InsertAttribute(attribute); WebApiCachingUserData.Remove(); return(true); } } } return(false); }