예제 #1
0
        public override SecurityElement ToXml()
        {
            SecurityElement se = PermissionHelper.Element(this.GetType(), version);

            if (IsUnrestricted())
            {
                se.AddAttribute("Unrestricted", "true");
            }
            else
            {
                foreach (ResourcePermissionBaseEntry entry in _list)
                {
                    SecurityElement container = se;
                    string          access    = null;
                    if (PermissionAccessType != null)
                    {
                        access = Enum.Format(PermissionAccessType, entry.PermissionAccess, "g");
                    }

                    for (int i = 0; i < _tags.Length; i++)
                    {
                        SecurityElement child = new SecurityElement(_tags [i]);
                        child.AddAttribute("name", entry.PermissionAccessPath [i]);
                        if (access != null)
                        {
                            child.AddAttribute("access", access);
                        }
                        container.AddChild(child);
                        child = container;
                    }
                }
            }
            return(se);
        }
        public override SecurityElement ToXml()
        {
            SecurityElement e = PermissionHelper.Element(typeof(DataProtectionPermission), version);

            e.AddAttribute("Flags", _flags.ToString());
            return(e);
        }
        public override SecurityElement ToXml()
        {
            SecurityElement e = PermissionHelper.Element(typeof(StorePermission), version);

            if (this.IsUnrestricted())
            {
                e.AddAttribute("Unrestricted", Boolean.TrueString);
            }
            else
            {
                e.AddAttribute("Flags", _flags.ToString());
            }
            return(e);
        }