<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Security.AccessControl.FileSecurity sec =
                 System.IO.File.GetAccessControl(Server.MapPath("PlikTekstowy.txt"));
        
        this.Label1.Text = 
                 sec.GetOwner( typeof(System.Security.Principal.NTAccount) ).Value;
      
        System.Security.AccessControl.AuthorizationRuleCollection auth =
                                     sec.GetAccessRules(true, true,
                                     typeof(System.Security.Principal.NTAccount));

        foreach (System.Security.AccessControl.FileSystemAccessRule r in auth)
        {
            TableRow tr = new TableRow();
            tr.Cells.Add(new TableCell() { Text=r.AccessControlType.ToString() });
            tr.Cells.Add(new TableCell() { Text=r.IdentityReference.Value });
            tr.Cells.Add(new TableCell() { Text=r.InheritanceFlags.ToString() });
            tr.Cells.Add(new TableCell() { Text=r.IsInherited.ToString() });
            tr.Cells.Add(new TableCell() { Text=r.PropagationFlags.ToString() });
            tr.Cells.Add(new TableCell() { Text=r.FileSystemRights.ToString() });
            Table1.Rows.Add(tr);
        }
    }
</script>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Wyświetlanie danych listy ACL</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p><b>Właściciel pliku:</b>
              <asp:Label ID="Label1" runat="server" Text="Label" /></p>        
        <p>
        Reguły dostępu:<br />
        <asp:Table ID="Table1" runat="server" CellPadding="2" GridLines="Both">
            <asp:TableRow>
                <asp:TableHeaderCell>Rodzaj operacji</asp:TableHeaderCell>
                <asp:TableHeaderCell>Użytkownik</asp:TableHeaderCell>
                <asp:TableHeaderCell>Znaczniki dziedziczenia</asp:TableHeaderCell>
                <asp:TableHeaderCell>Dziedziczenie</asp:TableHeaderCell>
                <asp:TableHeaderCell>Znaczniki propagacji</asp:TableHeaderCell>     
                <asp:TableHeaderCell>Prawa systemu plików</asp:TableHeaderCell>
            </asp:TableRow>
        </asp:Table>
        </p>        
    </div>
    </form>
</body>
</html>
