|
|
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
|
|
|
|
@ -26,9 +27,9 @@ namespace Platform.Api
|
|
|
|
|
private readonly IRepository<Building> _buildingRepo;
|
|
|
|
|
private readonly IRepository<Statistic> _statisticRepo;
|
|
|
|
|
|
|
|
|
|
public SiteController(ISettingService settingService,
|
|
|
|
|
IRepository<User> userRepo,
|
|
|
|
|
IRepository<AppModule> appModuleRepo,
|
|
|
|
|
public SiteController(ISettingService settingService,
|
|
|
|
|
IRepository<User> userRepo,
|
|
|
|
|
IRepository<AppModule> appModuleRepo,
|
|
|
|
|
IRepository<OrganUser> organUserRepo,
|
|
|
|
|
IRepository<Area> areaRepo,
|
|
|
|
|
IRepository<Organ> organRepo,
|
|
|
|
@ -38,7 +39,7 @@ namespace Platform.Api
|
|
|
|
|
this._settingService = settingService;
|
|
|
|
|
this._userRepo = userRepo;
|
|
|
|
|
this._appModuleRepo = appModuleRepo;
|
|
|
|
|
this._organUserRepo = organUserRepo;
|
|
|
|
|
this._organUserRepo = organUserRepo;
|
|
|
|
|
this._areaRepo = areaRepo;
|
|
|
|
|
this._organRepo = organRepo;
|
|
|
|
|
this._buildingRepo = buildingRepo;
|
|
|
|
@ -60,6 +61,7 @@ namespace Platform.Api
|
|
|
|
|
.Where(o => o.User.UserName == userName)
|
|
|
|
|
.Select(o => o.Organ)
|
|
|
|
|
.ToList();
|
|
|
|
|
var organId = User.GetOrganId();
|
|
|
|
|
var model = new LayoutModel
|
|
|
|
|
{
|
|
|
|
|
Name = this._settingService.GetValue("name"),
|
|
|
|
@ -69,7 +71,15 @@ namespace Platform.Api
|
|
|
|
|
Modules = modules,
|
|
|
|
|
Organs = organs,
|
|
|
|
|
CurrentOrganId = User.GetOrganId(),
|
|
|
|
|
User = User == null ? null : User.Identity as ClaimsIdentity
|
|
|
|
|
User = User == null ? null : User.Identity as ClaimsIdentity,
|
|
|
|
|
Roles = User == null
|
|
|
|
|
? new List<string>()
|
|
|
|
|
: this._organUserRepo.ReadOnlyTable()
|
|
|
|
|
.Where(o => o.User.UserName == userName)
|
|
|
|
|
.Where(o => o.OrganId == organId)
|
|
|
|
|
.SelectMany(o => o.UserRoles)
|
|
|
|
|
.Select(o => o.OrganRole.Name)
|
|
|
|
|
.ToList()
|
|
|
|
|
};
|
|
|
|
|
if (platformUser != null && model.User != null)
|
|
|
|
|
{
|
|
|
|
|