SPList.EffectiveBasePermissions property
Obtém as permissões efetivas de base do usuário atual para a lista, incluindo suas políticas e a associação ao grupo.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
Public Overrides ReadOnly Property EffectiveBasePermissions As SPBasePermissions
Get
'Uso
Dim instance As SPList
Dim value As SPBasePermissions
value = instance.EffectiveBasePermissions
public override SPBasePermissions EffectiveBasePermissions { get; }
Property value
Type: Microsoft.SharePoint.SPBasePermissions
Uma combinação bit a bit dos valores de enumeração que especifica as permissões efetivas que o usuário atual tem na lista.
Implements
ISecurableObject.EffectiveBasePermissions
Examples
O exemplo a seguir é um aplicativo de console que verifica se o usuário atual tem permissão de SPBasePermissions.ApproveItems na lista de documentos compartilhados em um site.
Imports System
Imports Microsoft.SharePoint
Module Test
Sub Main()
Using site As SPSite = New SPSite("https://localhost")
Using web As SPWeb = site.OpenWeb()
' Get a list to check permissions on.
Dim listUrl As String = web.RootFolder.ServerRelativeUrl + "shared documents"
Dim list As SPList = web.GetList(listUrl)
' Get the current user's rights mask for the list.
Dim permMask As SPBasePermissions = list.EffectiveBasePermissions
' Check for a specific permission.
Dim hasPermission As Boolean = (permMask & SPBasePermissions.ApproveItems) <> 0
Console.WriteLine(hasPermission)
End Using
End Using
Console.Write(vbCrLf + "Press ENTER to continue...")
Console.ReadLine()
End Sub
End Module
using System;
using Microsoft.SharePoint;
namespace Test
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("https://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
// Get a list to check permissions on.
string listUrl = web.RootFolder.ServerRelativeUrl + "shared documents";
SPList list = web.GetList(listUrl);
// Get the current user's rights mask for the list.
SPBasePermissions permMask = list.EffectiveBasePermissions;
// Check for a specific permission.
bool hasPermission = (permMask & SPBasePermissions.ApproveItems) != 0;
Console.WriteLine(hasPermission);
}
}
Console.Write("\nPress ENTER to continue...");
Console.ReadLine();
}
}
}