FromRegString() public static method

public static FromRegString ( string str ) : GroupAuthzRule
str string
return GroupAuthzRule
Exemplo n.º 1
0
        public static List <GroupAuthzRule> GetAuthzRules()
        {
            List <GroupAuthzRule> rules = new List <GroupAuthzRule>();

            string[] strRules = Settings.Store.GroupAuthzRules;
            foreach (string str in strRules)
            {
                GroupAuthzRule rule = GroupAuthzRule.FromRegString(str);
                if (rule != null)
                {
                    rules.Add(rule);
                }
                // else
                // Log error
                //m_logger.ErrorFormat("Unrecognized registry entry when loading authorization rule, ignoring: {0}", str);
            }
            return(rules);
        }
Exemplo n.º 2
0
        public static string SaveAuthzRules(List <GroupAuthzRule> rules)
        {
            string        ret     = "";
            List <string> strList = new List <string>();

            foreach (GroupRule rule in rules)
            {
                if (GroupAuthzRule.FromRegString(rule.ToRegString()) == null)
                {
                    ret += rule + "\n";
                    m_logger.ErrorFormat("Rule doesn't comply:{0}", rule);
                }
                else
                {
                    strList.Add(rule.ToRegString());
                }
            }
            Settings.Store.GroupAuthzRules = strList.ToArray();
            return(ret);
        }