public virtual async Task <IActionResult> Put(string key, [FromBody] EdmPluginDescriptor entity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { string systemName = key.Replace('-', '.'); var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName(systemName, LoadPluginsMode.All); if (pluginDescriptor == null) { return(NotFound()); } pluginDescriptor.FriendlyName = entity.FriendlyName; pluginDescriptor.DisplayOrder = entity.DisplayOrder; pluginDescriptor.LimitedToTenants.Clear(); if (!entity.LimitedToTenants.IsNullOrEmpty()) { pluginDescriptor.LimitedToTenants = entity.LimitedToTenants.ToList(); } PluginManager.SavePluginDescriptor(pluginDescriptor); } catch (Exception x) { //Logger.LogError(new EventId(), x, x.GetBaseException().Message); } return(Ok(entity)); }
public virtual async Task <IActionResult> Get(string key) { string systemName = key.Replace('-', '.'); var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName(systemName, LoadPluginsMode.All); EdmPluginDescriptor entity = pluginDescriptor; return(Json(JObject.FromObject(entity))); }
public virtual SingleResult <EdmPluginDescriptor> Get([FromODataUri] string key) { if (!CheckPermission(StandardPermissions.FullAccess)) { return(SingleResult.Create(Enumerable.Empty <EdmPluginDescriptor>().AsQueryable())); } string systemName = key.Replace('-', '.'); var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName(systemName, false); EdmPluginDescriptor entity = pluginDescriptor; return(SingleResult.Create(new[] { entity }.AsQueryable())); }
public virtual IHttpActionResult Put([FromODataUri] string key, EdmPluginDescriptor entity) { if (!CheckPermission(StandardPermissions.FullAccess)) { return(Unauthorized()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { string systemName = key.Replace('-', '.'); var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName(systemName, false); if (pluginDescriptor == null) { return(NotFound()); } pluginDescriptor.FriendlyName = entity.FriendlyName; pluginDescriptor.DisplayOrder = entity.DisplayOrder; pluginDescriptor.LimitedToTenants.Clear(); if (!entity.LimitedToTenants.IsNullOrEmpty()) { pluginDescriptor.LimitedToTenants = entity.LimitedToTenants.ToList(); } PluginFileParser.SavePluginDescriptionFile(pluginDescriptor); } catch (Exception x) { logger.Value.Error(x.Message, x); } return(Updated(entity)); }