[Serializable] |
UnionCodeGroup is the most common type of code group; the policy statement of all matching child code groups (and by extension their child code groups) are combined with the permission set of the matching parent code group. Thus, if its membership condition matches, this code group forms the union of its policy statement and those of all its child code groups that also match the evidence.
UnionCodeGroup code groups are the code groups created by the CASPOL utility (see ) and the .NET Framework Configuration tool (see the conceptual topic at MSDN: netframeworkadministrationtoolmscorcfgmsc).
ctor #1 | Initializes a new instance of the UnionCodeGroup class. |
AttributeString (inherited from System.Security.Policy.CodeGroup) |
Read-only See base class member description: System.Security.Policy.CodeGroup.AttributeString Gets a string representation of the attributes of the policy statement for the code group. |
Children (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Children Gets or sets an ordered list of the child code groups of a code group. |
Description (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Description Gets or sets the description of the code group. |
MembershipCondition (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.MembershipCondition Gets or sets the code group's membership condition. |
MergeLogic | Read-only Overridden: Gets the merge logic. |
Name (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Name Gets or sets the name of the code group. |
PermissionSetName (inherited from System.Security.Policy.CodeGroup) |
Read-only See base class member description: System.Security.Policy.CodeGroup.PermissionSetName Gets the name of the named permission set for the code group. |
PolicyStatement (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.PolicyStatement Gets or sets the policy statement associated with the code group. |
AddChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.AddChild Adds a child code group to the current code group. |
Copy | Overridden: Makes a deep copy of the current code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(object o) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(CodeGroup cg, bool compareChildren) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group, checking the child code groups as well, if specified. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state from an XML encoding. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e, PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state and policy level from an XML encoding. |
GetHashCode (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.GetHashCode Gets the hash code of the current code group. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
RemoveChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.RemoveChild Removes the specified child code group. |
Resolve | Overridden: Resolves policy for the code group and its descendants for a set of evidence. |
ResolveMatchingCodeGroups | Overridden: Resolves matching code groups. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml() See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object and its current state. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml(PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object, its current state, and the policy level within which the code exists. |
CreateXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.CreateXml When overridden in a derived class, serializes properties and internal state specific to a derived code group and adds the serialization to the specified SecurityElement. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
ParseXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.ParseXml When overridden in a derived class, reconstructs properties and internal state specific to a derived code group from the specified SecurityElement. |
Hierarchy:
public UnionCodeGroup( |
membershipCondition
policy
Exception Type | Condition |
---|---|
ArgumentException | The type of the membershipCondition parameter is not valid. -or- The type of the policy parameter is not valid. |
public virtual string AttributeString {get;}
|
public IList Children {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this property to null. |
public string Description {get; set;}
|
public IMembershipCondition MembershipCondition {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this parameter to null. |
public override string MergeLogic {get;}
|
public string Name {get; set;}
|
public virtual string PermissionSetName {get;}
|
public PolicyStatement PolicyStatement {get; set;}
|
This property can also be set by passing a policy statement to the constructor.
codeGroup.PolicyStatement = new PolicyStatement(new NamedPermissionSet("MyPermissionSet"));
public void AddChild( |
group
Exception Type | Condition |
---|---|
ArgumentNullException | The group parameter is null. |
ArgumentException | The group parameter is not a valid code group. |
public override CodeGroup Copy(); |
protected virtual void CreateXml( |
element
level
The XML created using this method is deserialized by the CodeGroup.ParseXml method.
o
This method tests the top-level code group only, not its child code groups.
cg
compareChildren
If the compareChildren parameter is true, this method will only return true if the current code group and all its child code groups are equivalent to the specified code group and all its child code groups.
~UnionCodeGroup(); |
public void FromXml( |
e
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public void FromXml( |
e
level
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public override int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
protected virtual void ParseXml( |
e
level
This method deserializes XML created using CodeGroup.CreateXml.
public void RemoveChild( |
group
Exception Type | Condition |
---|---|
ArgumentException | The group parameter is not an immediate child code group of the current code group. |
public override PolicyStatement Resolve( |
evidence
Exception Type | Condition |
---|---|
ArgumentNullException | The evidence parameter is null. |
ArgumentException | More than one code group (including the parent code group and any child code groups) is marked PolicyStatementAttribute.Exclusive. |
For union code groups, all child code groups whose membership condition match the evidence are also resolved and all resulting policy statements form a union with the policy statement of the parent union code group. Each child code group type determines how its child groups are applied, depending on how their respective UnionCodeGroup.Resolve methods work.
The .NET Framework security system uses UnionCodeGroup.Resolve on the policy levels to determine which permissions to grant to loaded code from the resulting policy statements and the code request on the assembly.
The operation of this method is as follows.
If the membership condition does not match the specified evidence, return null; otherwise set the permission set to be returned (P) equal to the code group's policy statement and continue. For each child code group, resolve the code group with the same evidence; if the result is not null, set P = the union of P and the child code group's policy statement. Return P, which is now the union of the current code group's policy statement and all child resolves.
evidence
Exception Type | Condition |
---|---|
ArgumentNullException | The evidence parameter is null. |
public virtual string ToString(); |
public SecurityElement ToXml(); |
public SecurityElement ToXml( |
level