Esempio n. 1
0
        private ReadOnlyCollection<HgAclEntry> ReadAclSection(HgRc hgRc, string section)
        {
            if(hgRc[section] == null) return null;
            var aclEntries = new List<HgAclEntry>();

            foreach(var property in hgRc[section].Properties)
            {
                var hgAclEntry = new HgAclEntry(property, ReadAclPrincipals(hgRc[section][property]).ToList());
                aclEntries.Add(hgAclEntry);
            } // foreach

            return new ReadOnlyCollection<HgAclEntry>(aclEntries);
        }
Esempio n. 2
0
        public HgAcl ReadAcl(HgRc hgRc)
        {
            if(hgRc == null)
            {
                log.Info("no hgrc");
                return null;
            } // if

            if(hgRc["acl"] == null)
            {
                log.Info("no [acl[ section in hgrc");
                return null;
            } // if

            var sources = hgRc["acl"]["sources"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            var deny = ReadAclSection(hgRc, "acl.deny");
            var allow = ReadAclSection(hgRc, "acl.allow");
            var allowBranches = ReadAclSection(hgRc, "acl.allow.branches");
            var denyBranches = ReadAclSection(hgRc, "acl.deny.branches");

            return new HgAcl(new ReadOnlyCollection<string>(sources), allow, deny, allowBranches, denyBranches);
        }