如何在djabgo中将中间件装饰器用于基于类的视图?

问题描述

如何将中间件装饰器用于基于类的视图?

$HTMLHeader = $null
$HTML_Body = $null
$HTMLEnd = $null
$HTMLHeader = @"
<html><head><title>Reporte de recursos en Azure</title>
<style type="text/css">
<!--
h1 {
    font-family: Arial,Helvetica,sans-serif;
    color: #e68a00;
    font-size: 28px;
}

h2 {
    font-family: Arial,sans-serif;
    color: #000099;
    font-size: 16px;
}
table {
    font-size: 12px;
    border: 0px; 
    font-family: Arial,sans-serif;
} 

td {
    padding: 4px;
    margin: 0px;
    border: 0;
}

th {
    background: #395870;
    background: linear-gradient(#49708f,#293f50);
    color: #fff;
    font-size: 11px;
    text-transform: uppercase;
    padding: 10px 15px;
    vertical-align: middle;
}

tbody tr:nth-child(even) {
    background: #f0f0f2;
}


#CreationDate {

    font-family: Arial,sans-serif;
    color: #ff3300;
    font-size: 12px;

}
-->
</style>
</head>
<body>"@
$DateCutOff = (Get-Date).AddDays(-30)
$USR_DB = Get-ADUser -Filter * -Property whenCreated | where { $_.whenCreated -gt $DateCutOff }
$HTML_Body+="<table border=""0"" width=""100%"" cellpadding=""4""  style=""font-size:8pt;font-family:Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;""><tr bgcolor=""#000099"">"
$HTML_Body+= "<th colspan= ""14"" ><font color=""#FFFFFF"">Users creation report</font></th></tr>"
$HTML_Body+="<tr bgcolor=""#0000FF"">"
$HTML_Body+="<th align=""center""><font color=""#FFFFFF"">Username</font></th>"
$HTML_Body+="<th align=""center""><font color=""#FFFFFF"">WhenCreated</font></th>"
$HTML_Body+="</tr>"
$HTML_Body+="<tr align=""center"" bgcolor=""#dddddd"">"
foreach ($USR in $USR_DB){
$INT_ALT_RW = 0

$HTML_Body+="<tr"
#region linea intercaladas
if ($INT_ALT_RW)
{
    $HTML_Body+=" style=""background-color:#dddddd"""
    $INT_ALT_RW=0
} else
{
    $INT_ALT_RW=1
}
#endregion linea intercaladas

$HTML_Body+=">"
$HTML_Body+="<td align=""center""><font color=""#000000"">$($USR.UserPrincipalName)</font></td>" 
$HTML_Body+="<td align=""center""><font color=""#000000"">$($USR.whenCreated)</font></td>"}
$HTML_Body+="</table>"
$HTML_Body+="</div>"
$HTMLEnd = "</body></html>"
$HTMLFile = $HTMLHeader + $HTML_Body + $HTMLEnd
Add-Type -AssemblyName System.Web
[System.Web.HttpUtility]::HtmlDecode($HTMLFile) | Out-File .\temporal.html 

这不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)