public ConCheckEntry(long policyID, DataSharingPolciy polciy) { PolicyID = policyID; foreach (var entry in polciy.JsonCompositeContex.Conteiexs) { if (entry.Contex.Interval > 0) { _updateIntervals.Add(entry.Contex, DateTime.Now.TimeOfDay); _results.Add(entry.Contex, false); } } }
public ActionResult <string> Create(string shareTokken, string resouceID, DataSharingPolciy polciy) { if (polciy.Id == null) { //TODO make this not bad polciy.Id = Utils.LongRandom(_random); } if (polciy.Interval == null) { polciy.Interval = -1; } if (!polciy.Vaild()) { return("ERROR:Invaild Json"); } var apiKey = _shareTokkens[shareTokken].ApiKey; var polciyResouce = PolciyResouce.GetInstance(); if (polciyResouce.OwnershipTable.ContainsKey(apiKey)) { var newTokken = Utils.CreateKey(10); var id = (long)polciy.Id; _secTokken.Add(newTokken, new SecTokenEntry() { PolicyID = id, ResID = resouceID }); ExportToFile(id, polciy); return(newTokken); } return("FAILLED"); }
public static async Task ExportToFile(long id, DataSharingPolciy polciy) { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed DataSharingPolicyParser.ExportToJson(polciy, "polcies\\policy" + id.ToString() + ".json"); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }