コード例 #1
0
 public static IPermission Create(string fullname, SecurityElement se)
 {
     if (fullname == null)
     {
         throw new ArgumentNullException("fullname");
     }
     if (se == null)
     {
         throw new ArgumentNullException("se");
     }
     return(PermissionBuilder.CreatePermission(fullname, se));
 }
コード例 #2
0
        public static IPermission Create(SecurityElement se)
        {
            if (se == null)
            {
                throw new ArgumentNullException("se");
            }
            string text = se.Attribute("class");

            if (text == null || text.Length == 0)
            {
                throw new ArgumentException("class");
            }
            return(PermissionBuilder.CreatePermission(text, se));
        }
コード例 #3
0
        public static IPermission Create(string fullname, PermissionState state)
        {
            if (fullname == null)
            {
                throw new ArgumentNullException("fullname");
            }
            SecurityElement securityElement = new SecurityElement("IPermission");

            securityElement.AddAttribute("class", fullname);
            securityElement.AddAttribute("version", "1");
            if (state == PermissionState.Unrestricted)
            {
                securityElement.AddAttribute("Unrestricted", "true");
            }
            return(PermissionBuilder.CreatePermission(fullname, securityElement));
        }