Freigeben über


WebPartsPersonalization.Authorization Eigenschaft

Definition

Ruft ein AuthorizationSection-Objekt ab, das die Webparts-Personalisierungsautorisierungen für die aktuelle Webanwendung enthält.

public:
 property System::Web::Configuration::WebPartsPersonalizationAuthorization ^ Authorization { System::Web::Configuration::WebPartsPersonalizationAuthorization ^ get(); };
[System.Configuration.ConfigurationProperty("authorization")]
public System.Web.Configuration.WebPartsPersonalizationAuthorization Authorization { get; }
[<System.Configuration.ConfigurationProperty("authorization")>]
member this.Authorization : System.Web.Configuration.WebPartsPersonalizationAuthorization
Public ReadOnly Property Authorization As WebPartsPersonalizationAuthorization

Eigenschaftswert

WebPartsPersonalizationAuthorization

Ein AuthorizationSection-Objekt, das die Webparts-Personalisierungsautorisierungen für die aktuelle Webanwendung enthält.

Attribute

Beispiele

Im folgenden Codebeispiel wird die Verwendung der Authorization-Eigenschaft veranschaulicht. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die WebPartsSection Klasse bereitgestellt wird.

// Add an authorization.
AuthorizationRule ar = 
    new AuthorizationRule(AuthorizationRuleAction.Allow);
ar.Verbs.Add("ModifyState");
ar.Users.Add("Admin");
webPartsSection.Personalization.Authorization.Rules.Add(ar);

// List current authorizations.
for (int ai = 0;
    ai < webPartsSection.Personalization.Authorization.Rules.Count; 
    ai++)
{
    Console.WriteLine("  #{0}:", ai);
    AuthorizationRule aRule = 
        webPartsSection.Personalization.Authorization.Rules[ai];
    Console.WriteLine("  Verbs=");
    foreach (string verb in aRule.Verbs)
        Console.WriteLine("    * {0}", verb);
    Console.WriteLine("  Roles=");
    foreach (string role in aRule.Roles)
        Console.WriteLine("    * {0}", role);
    Console.WriteLine("  Users=");
    foreach (string user in aRule.Users)
        Console.WriteLine("    * {0}", user);
}
' Add an authorization.
Dim ar As AuthorizationRule = _
  New AuthorizationRule(AuthorizationRuleAction.Allow)
ar.Verbs.Add("ModifyState")
ar.Users.Add("Admin")
webPartsSection.Personalization.Authorization.Rules.Add(ar)

' List current authorizations.
Dim ai As Integer
For ai = 0 To _
  webPartsSection.Personalization.Authorization.Rules.Count
    Console.WriteLine("  #{0}:", ai)
    Dim aRule As AuthorizationRule = _
      webPartsSection.Personalization.Authorization.Rules(ai)
    Console.WriteLine("  Verbs=")
    Dim verb As String
    For Each verb In aRule.Verbs
      Console.WriteLine("    * {0}", verb)
      Console.WriteLine("  Roles=")
    Next
    Dim role As String
    For Each role In aRule.Roles
      Console.WriteLine("    * {0}", role)
      Console.WriteLine("  Users=")
    Next
    Dim user As String
    For Each user In aRule.Users
      Console.WriteLine("    * {0}", user)
    Next
Next

Hinweise

Es muss mindestens ein gültiges Verb vorhanden sein, das jedem AuthorizationRule Objekt in der Auflistung zugeordnet ist.

Gilt für