1
我用下面的代碼,以檢查是否certin用戶存在於DACL
:如何檢查用戶是否具有對共享文件夾的完全控制權限?
Dim l_managemantObject As ManagementBaseObject() = CType(securityDescriptor.Properties("DACL").Value, ManagementBaseObject())
For Each mObject As ManagementBaseObject In l_managemantObject
l_name = CType(mObject.GetPropertyValue("Trustee"), ManagementBaseObject).Properties("Name").Value.ToString
If CType(mObject.GetPropertyValue("Trustee"), ManagementBaseObject).Properties("Domain").Value IsNot Nothing Then
l_domain = CType(mObject.GetPropertyValue("Trustee"), ManagementBaseObject).Properties("Domain").Value.ToString()
End If
If users.UserName.ToLower = (l_domain & "\" & l_name).ToLower Then
Return True
End If
Next
正如你所看到的,我能夠獲取用戶名和域名。但是,如何檢查用戶是否擁有FullControl
權限?
編輯:
我做furthur調查,發現使用GetAccessMask
,我可以檢索的訪問權限由用戶或組代表其返回的實例所持股份。
所以還剩下什麼是: 如何獲得特定用戶AccessMask
?