Zugriff auf Mandator im Mok überarbeitet

This commit is contained in:
Christian
2025-01-29 01:13:44 +01:00
parent abf58c6112
commit 75d09f3931
5 changed files with 18 additions and 21 deletions

View File

@@ -52,8 +52,10 @@ namespace BeWoPlanerMobil.Controllers
}
Log.Info($"LoginController.Index(): Loggedin User: {MobileSessionFacade.LoggedInUser.LoginName}");
MobileSessionFacade.Mandator = OperationsService.GetMandator();
var viewServiceRecords = AbstractModel.HasRightToSeeServiceRecords;//AbstractModel.CheckRight(UserRightType.ServiceRecordView_View);
var viewServiceRecords = AbstractModel.HasRightToSeeServiceRecords;//AbstractModel.CheckRight(UserRightType.ServiceRecordView_View);
var viewAll = AbstractModel.CheckRight(UserRightType.ViewAll);
var user = UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value);
@@ -140,7 +142,8 @@ namespace BeWoPlanerMobil.Controllers
}
public ActionResult Index(string tenant, string returnUrl)
public ActionResult Index(string tenant, string returnUrl)
{
if(returnUrl != null)
{

View File

@@ -70,20 +70,6 @@ namespace BeWoPlanerMobil.Controllers
private static readonly List<ValueListEntryType> Zieltypen = new List<ValueListEntryType> { ValueListEntryType.SupportConceptGoalCategoryType, ValueListEntryType.SupportConceptIndividualGoalCategoryType };
private static readonly List<ValueListEntryType> Massnahmentypen = new List<ValueListEntryType> { ValueListEntryType.SupportConceptGoalType, ValueListEntryType.SupportConceptIndividualGoalType };
private MandatorDC GetMandator()
{
var mandator = (MandatorDC) HttpContext.Session["mandator"];
if(!(mandator is null))
{
return mandator;
}
mandator = OperationsService.GetMandator();
HttpContext.Session["mandator"] = mandator;
return mandator;
}
[Authorize]
public ActionResult Main()
@@ -104,7 +90,7 @@ namespace BeWoPlanerMobil.Controllers
if(Model.Mandator is null)
{
Model.Mandator = GetMandator();
Model.Mandator = MobileSessionFacade.Mandator;
var mokSessionTimeout = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MoKSessionTimeout, 20);
@@ -2424,7 +2410,7 @@ namespace BeWoPlanerMobil.Controllers
}
}
var mandator = GetMandator();
var mandator = MobileSessionFacade.Mandator;
var maxDaysEditSRsAllowedString = GetSettingValue(mandator.Settings, SettingsKeys.MaxDaysEditServiceRecordsAllowed);
var limitFuerZeiterfassungString = GetSettingValue(mandator.Settings, SettingsKeys.AnzTageZeiterfassErfolgt);

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
@@ -46,7 +47,7 @@ namespace BeWoPlanerMobil.Models
{
get
{
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
var mandator = MobileSessionFacade.Mandator;
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowSignature);
#if DEBUG
@@ -89,7 +90,7 @@ namespace BeWoPlanerMobil.Models
{
get
{
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
var mandator = MobileSessionFacade.Mandator;
var hasSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowMedication) == "1";

View File

@@ -67,6 +67,13 @@ namespace BeWoPlanerMobil.Service
set => HttpContext.Current.Session["tenant"] = value;
}
public static MandatorDC Mandator
{
get => HttpContext.Current.Session["mandator"] as MandatorDC;
set => HttpContext.Current.Session["mandator"] = value;
}
public static bool IsUserLoggedIn()
{
return LoggedInUser != null;

View File

@@ -304,7 +304,7 @@
<div class="form-row">
<div class="col-md">
<div class="mt-3" id="single-booking-employee-container">
@Html.PopupWithSearchForIFilterables(Model.AllEmployees, "setSelectedEmployeeForSingleBooking", null, Model.SelectedEmployee?.DetailDescription, "single-booking-employee-modal-popup")
@Html.PopupWithSearchForIFilterables(Model.Employees, "setSelectedEmployeeForSingleBooking", null, Model.SelectedEmployee?.DetailDescription, "single-booking-employee-modal-popup")
</div>
</div>
</div>