Fixed permission for project list page.

pull/997/head
Alper Ebicoglu 7 years ago
parent 40c4fca3eb
commit 216c0cf0ce

@ -28,7 +28,7 @@
<div class="alert alert-secondary col-md-6 text-center" role="alert">
<p>@L["NoProjectWarning"]</p>
<hr />
<a href="@Model.CreateProjectLink">@L["CreateYourFirstProject"] <i class="fa fa-arrow-circle-right"></i></a>
<a href="/Docs/Admin/Projects">@L["CreateYourFirstProject"] <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div>
}

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.Users;
using Volo.Docs;
using Volo.Docs.Projects;
@ -11,23 +10,16 @@ namespace VoloDocs.Web.Pages
public class IndexModel : PageModel
{
public IReadOnlyList<ProjectDto> Projects { get; set; }
public string CreateProjectLink { get; set; }
private readonly IProjectAppService _projectAppService;
private readonly ICurrentUser _currentUser;
public IndexModel(IProjectAppService projectAppService, ICurrentUser currentUser)
public IndexModel(IProjectAppService projectAppService)
{
_projectAppService = projectAppService;
_currentUser = currentUser;
}
public async Task<IActionResult> OnGet()
{
CreateProjectLink = _currentUser.Id.HasValue
? "/Docs/Admin/Projects"
: "/Account/Login?returnUrl=/Docs/Admin/Projects";
Projects = (await _projectAppService.GetListAsync()).Items;
if (Projects.Count == 1)

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Volo.Docs.Admin
namespace Volo.Docs.Admin
{
public class DocsAdminPermissions
{

@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
{
[Authorize(DocsAdminPermissions.Projects.Default)]
public class IndexModel : AbpPageModel
{
public void OnGet()

Loading…
Cancel
Save