私はAsp.net MVCでangularjsを使用して、ユーザーのフォルダの書き込みアクセスをチェックしています。ユーザーに書き込みアクセス権がある場合は、リンクを持つdivを表示したいと思います。 SampleView.Html
にdivがあり、MVCコントローラでユーザの書き込みアクセスを確認するメソッドがReportController.cs
となっています。 MVCコントローラからAngularjsビューに値を渡すために使用できるAngular Controllerのコードは何ですか?MVCコントローラから角度ビューに値を渡す方法
SampleView.html:
<div id="DivPackerTemplate" class="cp-btn cp-btn-primary pull-right">
<a ng-href="\\Samplefolder" >Edit Template</a></div>
ReportController.cs:
public void AccessPackerPlanTemplate(string folderPath)
{
string path = @"\\sample";
string NtAccountName = @"sampleuser";
DirectoryInfo di = new DirectoryInfo(path);
DirectorySecurity acl = di.GetAccessControl(AccessControlSections.All);
AuthorizationRuleCollection rules = acl.GetAccessRules(true, true, typeof(NTAccount));
//Go through the rules returned from the DirectorySecurity
foreach (AuthorizationRule rule in rules)
{
//If we find one that matches the identity we are looking for
if (rule.IdentityReference.Value.Equals(NtAccountName, StringComparison.CurrentCultureIgnoreCase))
{
//Cast to a FileSystemAccessRule to check for access rights
if ((((FileSystemAccessRule)rule).FileSystemRights & FileSystemRights.WriteData) > 0)
{
//Show the link
{
DivPackerTemplate.Visible = false; \\This is not working is there a alternative for this?
}
}
}
}
divにng-showを使用 – holtc
divを非表示にするには、角型コントローラに何らかの値を送る必要があります。 HTMLページにはどのようなデータが表示されますか? divが隠されるべきかどうかのブールとして使用できるフィールドはありますか? –
@RaniRadcliff HTMLページは、誰もがフォルダへの書き込みアクセス権を持っている特定のユーザーだけにフォルダのリンクを表示したくないホームページのようなものです。このメソッドをVoidからboolに変換できます。 – Programmermid