Exemple #1
0
        public static void Save(AclConfigurationModel model)
        {
            var text = JsonConvert.SerializeObject(model, Formatting.Indented);

            FileWithAcl.WriteAllText(CfgFile, text, "644", "root", "wheel");
            ConsoleLogger.Log("[acl] configuration saved");
        }
Exemple #2
0
        public void Save(AclConfigurationModel model)
        {
            var text = JsonConvert.SerializeObject(model, Formatting.Indented);

            if (File.Exists(_cfgFile))
            {
                File.Copy(_cfgFile, _cfgFileBackup, true);
            }
            File.WriteAllText(_cfgFile, text);
            ConsoleLogger.Log("[acl] configuration saved");
        }
Exemple #3
0
 public AclConfiguration()
 {
     IoDir.CreateDirectory(Parameter.AntdCfgServices);
     IoDir.CreateDirectory(_storeDir);
     IoDir.CreateDirectory(_storeDirTemplate);
     if (!File.Exists(_cfgFile))
     {
         _serviceModel = new AclConfigurationModel();
     }
     else
     {
         try {
             var text = File.ReadAllText(_cfgFile);
             var obj  = JsonConvert.DeserializeObject <AclConfigurationModel>(text);
             _serviceModel = obj;
         }
         catch (Exception) {
             _serviceModel = new AclConfigurationModel();
         }
     }
 }