-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathAccessControl.razor
More file actions
61 lines (57 loc) · 2.68 KB
/
Copy pathAccessControl.razor
File metadata and controls
61 lines (57 loc) · 2.68 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@using LinkDotNet.Blog.Web.Features.Services
@inject IOptions<ApplicationConfiguration> AppConfiguration
@inject ICurrentUserService CurrentUserService
<AuthorizeView>
<Authorized>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="user-tie"></i> Admin
</a>
<ul class="dropdown-menu ps-0" aria-labelledby="navbarDropdown">
<li><h6 class="dropdown-header">Blog posts</h6></li>
<li><a class="dropdown-item" href="create">Create new</a></li>
<li><a class="dropdown-item" href="draft">Show drafts</a></li>
<li><a class="dropdown-item" href="settings">Show settings</a></li>
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">Analytics</h6></li>
<li><a class="dropdown-item" href="dashboard">Dashboard</a></li>
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">Others</h6></li>
<li><a class="dropdown-item" href="short-codes">Shortcodes</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" target="_blank" href="https://github.com/linkdotnet/Blog/releases" rel="noreferrer">Releases</a></li>
</ul>
</li>
@if (authorName is not null)
{
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="user-tie"></i> @authorName
</a>
<ul class="dropdown-menu ps-0" aria-labelledby="navbarDropdown">
<li><a class="nav-link" href="logout?redirectUri=@CurrentUri"><i class="lock"></i> Log out</a></li>
</ul>
</li>
}
else
{
<li class="nav-item"><a class="nav-link" href="/logout?redirectUri=@CurrentUri"><i class="lock"></i> Log out</a></li>
}
</Authorized>
<NotAuthorized>
<li class="nav-item"><a class="nav-link" href="/login?redirectUri=@CurrentUri" rel="nofollow"><i class="unlocked"></i> Log in</a></li>
</NotAuthorized>
</AuthorizeView>
@code {
[Parameter]
public string CurrentUri { get; set; } = string.Empty;
private string? authorName;
protected override async Task OnInitializedAsync()
{
if (AppConfiguration.Value.UseMultiAuthorMode)
{
authorName = await CurrentUserService.GetDisplayNameAsync();
}
}
}