Parse() public static method

Extracts a list of ACEs from a SDDL string.
public static Parse ( string sddl ) : IList
sddl string
return IList
コード例 #1
0
        /// <summary>
        /// Extracts the access rules from the SDDL string.
        /// </summary>
        private static void ParseSddl(string url, string sddl, List <HttpAccessRule> accessRules)
        {
            IList <AccessControlEntity> entities = AccessControlEntity.Parse(sddl);

            for (int ii = 0; ii < entities.Count; ii++)
            {
                AccessControlEntity entity = entities[ii];

                if (entity.AccessType != "A")
                {
                    continue;
                }

                ApplicationAccessRight rights = ApplicationAccessRight.None;

                switch (entity.Rights)
                {
                case "GA":
                case "GXGW":
                case "GWGX":
                {
                    rights = ApplicationAccessRight.Configure;
                    break;
                }

                case "GX":
                {
                    rights = ApplicationAccessRight.Run;
                    break;
                }
                }

                if (rights == ApplicationAccessRight.None)
                {
                    continue;
                }

                string accountName = ApplicationAccessRule.SidToAccountName(entity.AccountSid);

                if (String.IsNullOrEmpty(accountName))
                {
                    continue;
                }

                HttpAccessRule rule = new HttpAccessRule();

                rule.UrlPrefix    = url;
                rule.Right        = rights;
                rule.IdentityName = accountName;

                accessRules.Add(rule);
            }
        }
コード例 #2
0
        /// <summary>
        /// Extracts the access rules from the SDDL string.
        /// </summary>
        private static void ParseSddl(string url, string sddl, List <HttpAccessRule> accessRules)
        {
            IList <AccessControlEntity> entities = AccessControlEntity.Parse(sddl);

            for (int ii = 0; ii < entities.Count; ii++)
            {
                AccessControlEntity entity = entities[ii];

                if (entity.AccessType != "A")
                {
                    continue;
                }

                ApplicationAccessRight rights = ApplicationAccessRight.None;

                switch (entity.Rights)
                {
                case "GA":
                case "GXGW":
                case "GWGX":
                {
                    rights = ApplicationAccessRight.Configure;
                    break;
                }

                case "GX":
                {
                    rights = ApplicationAccessRight.Run;
                    break;
                }
                }

                if (rights == ApplicationAccessRight.None)
                {
                    continue;
                }
            }
        }