Compartilhar via


WebPartsPersonalization.Authorization Propriedade

Definição

Obtém um objeto AuthorizationSection que contém as autorizações de personalização de Web Parts para o aplicativo Web atual.

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

Valor da propriedade

Um AuthorizationSection objeto que contém as autorizações de personalização de Web Parts para o aplicativo Web atual.

Atributos

Exemplos

O exemplo de código a seguir mostra como usar a Authorization propriedade . Este exemplo de código faz parte de um exemplo maior fornecido para a WebPartsSection classe .

// 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

Comentários

Deve haver pelo menos um verbo válido associado a cada AuthorizationRule objeto na coleção.

Aplica-se a