14 [OptionalField(VersionAdded = 2)]
15 private bool m_unrestricted;
17 [OptionalField(VersionAdded = 2)]
18 private SiteString[] m_sites;
20 [OptionalField(VersionAdded = 2)]
21 private string m_serializedPermission;
23 private SiteString m_site;
36 if (m_sites.Length == 1)
38 return m_sites[0].ToString();
44 m_unrestricted =
false;
45 m_sites =
new SiteString[1];
46 m_sites[0] =
new SiteString(value);
53 if (m_serializedPermission !=
null)
56 m_serializedPermission =
null;
58 else if (m_site !=
null)
60 m_unrestricted =
false;
61 m_sites =
new SiteString[1];
73 if (m_sites !=
null && m_sites.Length == 1)
85 m_serializedPermission =
null;
98 m_unrestricted =
true;
101 m_unrestricted =
false;
121 siteIdentityPermission.m_unrestricted = m_unrestricted;
124 siteIdentityPermission.m_sites =
new SiteString[m_sites.Length];
125 for (
int i = 0; i < m_sites.Length; i++)
127 siteIdentityPermission.m_sites[i] = m_sites[i].Copy();
130 return siteIdentityPermission;
150 if (m_sites.Length == 0)
157 if (siteIdentityPermission ==
null)
161 if (siteIdentityPermission.m_unrestricted)
171 SiteString[] sites = m_sites;
172 foreach (SiteString siteString
in sites)
175 if (siteIdentityPermission.m_sites !=
null)
177 SiteString[] sites2 = siteIdentityPermission.m_sites;
178 foreach (SiteString operand
in sites2)
180 if (siteString.IsSubsetOf(operand))
207 if (siteIdentityPermission ==
null)
211 if (m_unrestricted && siteIdentityPermission.m_unrestricted)
214 siteIdentityPermission2.m_unrestricted =
true;
215 return siteIdentityPermission2;
219 return siteIdentityPermission.
Copy();
221 if (siteIdentityPermission.m_unrestricted)
225 if (m_sites ==
null || siteIdentityPermission.m_sites ==
null || m_sites.Length == 0 || siteIdentityPermission.m_sites.Length == 0)
230 SiteString[] sites = m_sites;
231 foreach (SiteString siteString
in sites)
233 SiteString[] sites2 = siteIdentityPermission.m_sites;
234 foreach (SiteString operand
in sites2)
236 SiteString siteString2 = siteString.Intersect(operand);
237 if (siteString2 !=
null)
239 list.Add(siteString2);
248 siteIdentityPermission3.m_sites = list.ToArray();
249 return siteIdentityPermission3;
260 if ((m_sites ==
null || m_sites.Length == 0) && !m_unrestricted)
267 if (siteIdentityPermission ==
null)
271 if (m_unrestricted || siteIdentityPermission.m_unrestricted)
274 siteIdentityPermission2.m_unrestricted =
true;
275 return siteIdentityPermission2;
277 if (m_sites ==
null || m_sites.Length == 0)
279 if (siteIdentityPermission.m_sites ==
null || siteIdentityPermission.m_sites.Length == 0)
283 return siteIdentityPermission.
Copy();
285 if (siteIdentityPermission.m_sites ==
null || siteIdentityPermission.m_sites.Length == 0)
290 SiteString[] sites = m_sites;
291 foreach (SiteString item
in sites)
295 SiteString[] sites2 = siteIdentityPermission.m_sites;
296 foreach (SiteString siteString
in sites2)
299 foreach (SiteString item2
in list)
301 if (siteString.Equals(item2))
309 list.Add(siteString);
313 siteIdentityPermission3.m_sites = list.ToArray();
314 return siteIdentityPermission3;
323 m_unrestricted =
false;
326 string text = esd.Attribute(
"Unrestricted");
327 if (text !=
null &&
string.Compare(text,
"true",
StringComparison.OrdinalIgnoreCase) == 0)
329 m_unrestricted =
true;
332 string text2 = esd.Attribute(
"Site");
336 list.Add(
new SiteString(text2));
339 if (children !=
null)
343 text2 = item.Attribute(
"Site");
346 list.Add(
new SiteString(text2));
352 m_sites = list.ToArray();
365 else if (m_sites !=
null)
367 if (m_sites.Length == 1)
373 for (
int i = 0; i < m_sites.Length; i++)
377 securityElement.
AddChild(securityElement2);
381 return securityElement;
384 int IBuiltInPermission.GetTokenIndex()
386 return GetTokenIndex();
389 internal static int GetTokenIndex()
override IPermission Copy()
Creates and returns an identical copy of the current permission.
StreamingContextStates State
Gets the source or destination of the transmitted data.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
override SecurityElement ToXml()
Creates an XML encoding of the permission and its current state.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
override void FromXml(SecurityElement esd)
Reconstructs a permission with a specified state from an XML encoding.
void AddChild(SecurityElement child)
Adds a child element to the XML element.
SiteIdentityPermission(PermissionState state)
Initializes a new instance of the T:System.Security.Permissions.SiteIdentityPermission class with the...
Provides information about, and means to manipulate, the current environment and platform....
Represents the XML object model for encoding security objects. This class cannot be inherited.
override bool IsSubsetOf(IPermission target)
Determines whether the current permission is a subset of the specified permission.
Defines the underlying structure of all code access permissions.
Defines the identity permission for the Web site from which the code originates. This class cannot be...
override IPermission Union(IPermission target)
Creates a permission that is the union of the current permission and the specified permission.
Defines methods implemented by permission types.
The exception that is thrown when one of the arguments provided to a method is not valid.
static SecurityElement FromString(string xml)
Creates a security element from an XML-encoded string.
override IPermission Intersect(IPermission target)
Creates and returns a permission that is the intersection of the current permission and the specified...
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
override string ToString()
Creates and returns a string representation of the current permission object.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
ArrayList Children
Gets or sets the array of child elements of the XML element.
string Site
Gets or sets the current site.
StreamingContextStates
Defines a set of flags that specifies the source or destination context for the stream during seriali...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...
SiteIdentityPermission(string site)
Initializes a new instance of the T:System.Security.Permissions.SiteIdentityPermission class to repre...
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...