blob: a6474471bd2b7087c987d28af5bbf6e79a4ba0ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
@using Microsoft.AspNet.Identity
@model Project_Unite.Models.ForumPost
@{
string acl_perm_delete = "CanDeletePosts";
string acl_perm_edit = "CanEditPosts";
if (User.Identity.GetUserId() == Model.AuthorId)
{
acl_perm_delete = "CanDeleteOwnPosts";
acl_perm_edit = "CanEditOwnPosts";
}
}
<ul class="nav nav-tabs">
@if(ACL.Granted(User.Identity.Name, acl_perm_edit))
{
<li><a href="@Url.Action("EditPost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-pencil"></span> Edit</a></li>
}
@if (ACL.Granted(User.Identity.Name, acl_perm_delete))
{
<li><a href="@Url.Action("DeletePost", "Forum", new { id = Model.Id })"><span class="glyphicon glyphicon-trash"></span> Delete</a></li>
}
</ul>
<hr/>
|