Files
BeWoPlaner/BeWoPlanerMobil/Controllers/DevelopmentController.cs
2020-12-30 12:30:33 +01:00

558 lines
32 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using BeWoPlanerMobil.Models;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Extensions;
using static BS.Shared.UserRightType;
namespace BeWoPlanerMobil.Controllers
{
// TODO: Rechte einstellen ungeachtet der Rechte das zu dürfen
// TODO: Termine erstellen (alle möglichen Kombinationen)
// TODO: Zeiterfassungseinträge erstellen
// TODO: Dokumentationsfelder anlegen
// TODO:
// TODO:
// TODO:
// TODO:
public class DevelopmentController : AbstractBaseController
{
private DevelopmentModel _Model;
public DevelopmentModel Model
{
get
{
if(!MobileSessionFacade.IsUserLoggedIn())
{
RedirectToActionPermanent("Index", "Login");
return null;
}
if(((DevelopmentModel) Session[ModelSessionConstants.DevelopmentModelKey])?.Employee == null)
{
_Model = new DevelopmentModel {Employee = MobileSessionFacade.LoggedInEmployee};
Session[ModelSessionConstants.DevelopmentModelKey] = _Model;
}
else
{
_Model = (DevelopmentModel) Session[ModelSessionConstants.DevelopmentModelKey];
}
return _Model;
}
}
[Authorize]
public ActionResult Development()
{
#if !DEBUG
return RedirectToActionPermanent("Main", "Main");
#endif
if(!MobileSessionFacade.IsUserLoggedIn() || Model == null)
{
return RedirectToActionPermanent("Index", "Login");
}
// 1. Universalrechte
var universalRechteGroup = new UserRightGroup("Universalrechte", new Dictionary<UserRightType, string>
{
{ViewAll, EnumTranslations.AllTranslations[ViewAll]},
{CreateAll, EnumTranslations.AllTranslations[CreateAll]},
{EditAll, EnumTranslations.AllTranslations[EditAll]},
{DeleteAll, EnumTranslations.AllTranslations[DeleteAll]}
});
// 2. Zeiterfassung
var serviceRecordRightGroup = new UserRightGroup("Zeiterfassung", new Dictionary<UserRightType, string>
{
{ServiceRecordView_View, EnumTranslations.AllTranslations[ServiceRecordView_View]},
{ServiceRecordView_Edit, EnumTranslations.AllTranslations[ServiceRecordView_Edit]},
{ServiceRecordView_Create, EnumTranslations.AllTranslations[ServiceRecordView_Create]},
{ServiceRecordView_Delete, EnumTranslations.AllTranslations[ServiceRecordView_Delete]},
{ServiceRecord_AllowChangeWithin24Hours, EnumTranslations.AllTranslations[ServiceRecord_AllowChangeWithin24Hours]},
{ServiceRecord_AllowCreateServiceRecordsForAllClients, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateServiceRecordsForAllClients]},
{ServiceRecord_AllowCreationForOtherEmployees, EnumTranslations.AllTranslations[ServiceRecord_AllowCreationForOtherEmployees]},
{ServiceRecord_AllowEditAfterMaxDaysInNextMonth, EnumTranslations.AllTranslations[ServiceRecord_AllowEditAfterMaxDaysInNextMonth]},
{ServiceRecord_AllowCreateMoreFLSThanApproved, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateMoreFLSThanApproved]},
{ServiceRecord_AllowCreateOverlappingFLS, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateOverlappingFLS]},
{ServiceRecord_AllowCreationForOtherTeamMember, EnumTranslations.AllTranslations[ServiceRecord_AllowCreationForOtherTeamMember]},
{BookServiceRecordOutOfSupportConcept, EnumTranslations.AllTranslations[BookServiceRecordOutOfSupportConcept]},
{BookServiceRecordAfterSettlementInvoice, EnumTranslations.AllTranslations[BookServiceRecordAfterSettlementInvoice]},
{ServiceRecord_ShowHistory, EnumTranslations.AllTranslations[ServiceRecord_ShowHistory]},
{ServiceRecord_AllowCreateOverlappingFLSForEmployee, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateOverlappingFLSForEmployee]},
{ServiceRecord_AllowCreatingGroupBooking, EnumTranslations.AllTranslations[ServiceRecord_AllowCreatingGroupBooking]},
{ServiceRecord_AllowCreatingMultiBooking, EnumTranslations.AllTranslations[ServiceRecord_AllowCreatingMultiBooking]},
{ServiceRecord_AllowEditForOtherEmployees, EnumTranslations.AllTranslations[ServiceRecord_AllowEditForOtherEmployees]},
{ServiceRecordAllowRebooking, EnumTranslations.AllTranslations[ServiceRecordAllowRebooking]},
{ServiceRecordAllowEditAfterMindays, EnumTranslations.AllTranslations[ServiceRecordAllowEditAfterMindays]},
{ServiceRecord_AllowCreateAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowCreateAfterEmployeeSignature]},
{ServiceRecord_AllowEditAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowEditAfterEmployeeSignature]},
{ServiceRecord_AllowDeleteAfterEmployeeSignature, EnumTranslations.AllTranslations[ServiceRecord_AllowDeleteAfterEmployeeSignature]},
{BewertenInZeiterfassung, EnumTranslations.AllTranslations[BewertenInZeiterfassung]}
});
// 3. Finanzen
var financeRightGroup = new UserRightGroup("Finanzen", new Dictionary<UserRightType, string>
{
{AccountingTransactionView_View, EnumTranslations.AllTranslations[AccountingTransactionView_View] },
{AccountingTransactionView_Edit, EnumTranslations.AllTranslations[AccountingTransactionView_Edit] },
{AccountingTransactionView_Create, EnumTranslations.AllTranslations[AccountingTransactionView_Create] },
{AccountingTransactionView_Delete, EnumTranslations.AllTranslations[AccountingTransactionView_Delete] }
});
// 4. Ressourcen
var resourceRightGroup = new UserRightGroup("Ressourcen", new Dictionary<UserRightType, string>
{
{ResourceBookingView_View, EnumTranslations.AllTranslations[ResourceBookingView_View] },
{ResourceBookingView_Edit, EnumTranslations.AllTranslations[ResourceBookingView_Edit] },
{ResourceBookingView_Create, EnumTranslations.AllTranslations[ResourceBookingView_Create] },
{ResourceBookingView_Delete, EnumTranslations.AllTranslations[ResourceBookingView_Delete] }
});
// 5. Berichte
var reportRightView = new UserRightGroup("Berichte", new Dictionary<UserRightType, string>
{
{QueryView_View, EnumTranslations.AllTranslations[QueryView_View] },
{QueryView_Edit, EnumTranslations.AllTranslations[QueryView_Edit] },
{QueryView_Create, EnumTranslations.AllTranslations[QueryView_Create] },
{QueryView_Delete, EnumTranslations.AllTranslations[QueryView_Delete] }
});
// 6. Hilfepläne
var supportConceptRightGroup = new UserRightGroup("Hilfepläne", new Dictionary<UserRightType, string>
{
{SupportConceptView_View, EnumTranslations.AllTranslations[SupportConceptView_View] },
{SupportConceptView_Edit, EnumTranslations.AllTranslations[SupportConceptView_Edit] },
{SupportConceptView_Create, EnumTranslations.AllTranslations[SupportConceptView_Create] },
{SupportConceptView_Delete, EnumTranslations.AllTranslations[SupportConceptView_Delete] },
{SupportConcept_ViewAllSupportConcepts, EnumTranslations.AllTranslations[SupportConcept_ViewAllSupportConcepts] },
{SupportConcept_AllowGoalOrientedSupportConcepts, EnumTranslations.AllTranslations[SupportConcept_AllowGoalOrientedSupportConcepts] },
{SupportConceptView_AllowArchiving, EnumTranslations.AllTranslations[SupportConceptView_AllowArchiving] },
{SupportConcept_ViewMyTeams, EnumTranslations.AllTranslations[SupportConcept_ViewMyTeams] },
{SupportConcept_AllowEditGoals, EnumTranslations.AllTranslations[SupportConcept_AllowEditGoals] },
{SupportConcept_AllowEditTasks, EnumTranslations.AllTranslations[SupportConcept_AllowEditTasks] },
{SupportConceptAllowReactivation, EnumTranslations.AllTranslations[SupportConceptAllowReactivation] },
{CostbearerAllowChange, EnumTranslations.AllTranslations[CostbearerAllowChange] }
});
// 7. Klienten
var customerRightGroup = new UserRightGroup("Klienten", new Dictionary<UserRightType, string>
{
{CustomerView_View,EnumTranslations.AllTranslations[CustomerView_View]},
{CustomerView_Edit,EnumTranslations.AllTranslations[CustomerView_Edit]},
{CustomerView_Create,EnumTranslations.AllTranslations[CustomerView_Create]},
{CustomerView_Delete,EnumTranslations.AllTranslations[CustomerView_Delete]},
{Customer_ViewMyCustomers,EnumTranslations.AllTranslations[Customer_ViewMyCustomers]},
{Customer_AllowArchiving,EnumTranslations.AllTranslations[Customer_AllowArchiving]},
{Customer_ViewMyTeams,EnumTranslations.AllTranslations[Customer_ViewMyTeams]},
{CustomerAllowReactivation,EnumTranslations.AllTranslations[CustomerAllowReactivation]},
{Customer_ViewMedication,EnumTranslations.AllTranslations[Customer_ViewMedication]},
{Customer_ViewDiagnosis,EnumTranslations.AllTranslations[Customer_ViewDiagnosis]},
{CustomerTeam_View,EnumTranslations.AllTranslations[CustomerTeam_View]},
{CustomerTeam_Edit,EnumTranslations.AllTranslations[CustomerTeam_Edit]},
{CustomerTeam_Delete,EnumTranslations.AllTranslations[CustomerTeam_Delete]},
{CustomerTeam_Create,EnumTranslations.AllTranslations[CustomerTeam_Create]},
{Customer_Anonymization,EnumTranslations.AllTranslations[Customer_Anonymization]},
{Customer_Full_Delete,EnumTranslations.AllTranslations[Customer_Full_Delete]}
});
// 8. Organisationen
var organisationRightGroup = new UserRightGroup("Organisationen", new Dictionary<UserRightType, string>
{
{OrganisationView_View,EnumTranslations.AllTranslations[OrganisationView_View]},
{OrganisationView_Edit,EnumTranslations.AllTranslations[OrganisationView_Edit]},
{OrganisationView_Create,EnumTranslations.AllTranslations[OrganisationView_Create]},
{OrganisationView_Delete,EnumTranslations.AllTranslations[OrganisationView_Delete]},
{OrganisationView_AllowEditCostBearer,EnumTranslations.AllTranslations[OrganisationView_AllowEditCostBearer]},
{Organisation_AllowArchiving,EnumTranslations.AllTranslations[Organisation_AllowArchiving]},
{OrganisationAllowReactivation,EnumTranslations.AllTranslations[OrganisationAllowReactivation]}
});
// 9. Personen
var personRightGroup = new UserRightGroup("Personen", new Dictionary<UserRightType, string>
{
{PersonView_View,EnumTranslations.AllTranslations[PersonView_View]},
{PersonView_Edit,EnumTranslations.AllTranslations[PersonView_Edit]},
{PersonView_Create,EnumTranslations.AllTranslations[PersonView_Create]},
{PersonView_Delete,EnumTranslations.AllTranslations[PersonView_Delete]},
{Person_AllowArchiving,EnumTranslations.AllTranslations[Person_AllowArchiving]},
{PersonAllowReactivation,EnumTranslations.AllTranslations[PersonAllowReactivation]},
{Person_Full_Delete,EnumTranslations.AllTranslations[Person_Full_Delete]}
});
// 10. Mitarbeiter
var employeeRightGroup = new UserRightGroup("Mitarbeiter", new Dictionary<UserRightType, string>
{
{EmployeeView_View,EnumTranslations.AllTranslations[EmployeeView_View]},
{EmployeeView_Edit,EnumTranslations.AllTranslations[EmployeeView_Edit]},
{EmployeeView_Create,EnumTranslations.AllTranslations[EmployeeView_Create]},
{EmployeeView_Delete,EnumTranslations.AllTranslations[EmployeeView_Delete]},
{Employee_AllowEditExtendedProperties,EnumTranslations.AllTranslations[Employee_AllowEditExtendedProperties]},
{Employee_AllowEditContracts,EnumTranslations.AllTranslations[Employee_AllowEditContracts]},
{Employee_AllowEditOwnEmployees,EnumTranslations.AllTranslations[Employee_AllowEditOwnEmployees]},
{Employee_AllowArchiving,EnumTranslations.AllTranslations[Employee_AllowArchiving]},
{Employee_AllowViewOwnEmployees,EnumTranslations.AllTranslations[Employee_AllowViewOwnEmployees]},
{Employee_AllowViewOwnTeam,EnumTranslations.AllTranslations[Employee_AllowViewOwnTeam]},
{Employee_ShowFinance,EnumTranslations.AllTranslations[Employee_ShowFinance]},
{EmployeeAllowReactivation,EnumTranslations.AllTranslations[EmployeeAllowReactivation]},
{Employee_Full_Delete,EnumTranslations.AllTranslations[Employee_Full_Delete]},
{Employee_Anonymization,EnumTranslations.AllTranslations[Employee_Anonymization]}
});
// 11. Teams
var teamRightGroup = new UserRightGroup("Teams", new Dictionary<UserRightType, string>
{
{TeamView_ViewAll,EnumTranslations.AllTranslations[TeamView_ViewAll]},
{TeamView_Edit,EnumTranslations.AllTranslations[TeamView_Edit]},
{TeamView_Create,EnumTranslations.AllTranslations[TeamView_Create]},
{TeamView_Delete,EnumTranslations.AllTranslations[TeamView_Delete]},
{TeamView_ViewMyTeams,EnumTranslations.AllTranslations[TeamView_ViewMyTeams]}
});
// 12. Benutzer
var userRightGroup = new UserRightGroup("Benutzer", new Dictionary<UserRightType, string>
{
{UserView_View,EnumTranslations.AllTranslations[UserView_View]},
{UserView_Edit,EnumTranslations.AllTranslations[UserView_Edit]},
{UserView_Create,EnumTranslations.AllTranslations[UserView_Create]},
{UserView_Delete,EnumTranslations.AllTranslations[UserView_Delete]},
{User_AllowOrderLicense,EnumTranslations.AllTranslations[User_AllowOrderLicense]},
{UserView_AllowChangePassword,EnumTranslations.AllTranslations[UserView_AllowChangePassword]},
{AllowChangeOwnPassword,EnumTranslations.AllTranslations[AllowChangeOwnPassword]}
});
// 13. Benutzergruppen
var userGroupRightGroup = new UserRightGroup("Benutzergruppen", new Dictionary<UserRightType, string>
{
{UserGroupView_View, EnumTranslations.AllTranslations[UserGroupView_View]},
{UserGroupView_Edit, EnumTranslations.AllTranslations[UserGroupView_Edit]},
{UserGroupView_Create, EnumTranslations.AllTranslations[UserGroupView_Create]},
{UserGroupView_Delete, EnumTranslations.AllTranslations[UserGroupView_Delete]}
});
// 14. Verwaltung
var administrationRightGroup = new UserRightGroup("Verwaltung", new Dictionary<UserRightType, string>
{
{AdministrationView_View, EnumTranslations.AllTranslations[AdministrationView_View]},
{AdministrationView_Edit, EnumTranslations.AllTranslations[AdministrationView_Edit]},
{AdministrationView_Create, EnumTranslations.AllTranslations[AdministrationView_Create]},
{AdministrationView_Delete, EnumTranslations.AllTranslations[AdministrationView_Delete]}
});
// 15. Auswertungen
var analysisRightGroup = new UserRightGroup("Auswertungen", new Dictionary<UserRightType, string>
{
{Analysis_Settlement_View, EnumTranslations.AllTranslations[Analysis_Settlement_View]},
{Analysis_EmployeeOverviewAll_View, EnumTranslations.AllTranslations[Analysis_EmployeeOverviewAll_View]},
{Analysis_ServiceOverview_View, EnumTranslations.AllTranslations[Analysis_ServiceOverview_View]},
{Analysis_SupportConceptOverviewAll_View, EnumTranslations.AllTranslations[Analysis_SupportConceptOverviewAll_View]},
{Analysis_AllowFLSOverviewForCostbearer, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForCostbearer]},
{Analysis_AuslastungAllEmployee_View, EnumTranslations.AllTranslations[Analysis_AuslastungAllEmployee_View]},
{Analysis_AuslastungTeam_View, EnumTranslations.AllTranslations[Analysis_AuslastungTeam_View]},
{Analysis_Auslastung_View, EnumTranslations.AllTranslations[Analysis_Auslastung_View]},
{Analysis_AllowFLSOverviewForTeam, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForTeam]},
{Analysis_AllowFLSOverviewForAllTeams, EnumTranslations.AllTranslations[Analysis_AllowFLSOverviewForAllTeams]},
{Kilometerauswertung_View, EnumTranslations.AllTranslations[Kilometerauswertung_View]},
{BewertungAuswertung_View, EnumTranslations.AllTranslations[BewertungAuswertung_View]},
{PivotTabelleAnsehen, EnumTranslations.AllTranslations[PivotTabelleAnsehen]},
{ResourceBookingView_AllowEditResourcesFromOtherEmployees, EnumTranslations.AllTranslations[ResourceBookingView_AllowEditResourcesFromOtherEmployees]},
{Jahresbericht, EnumTranslations.AllTranslations[Jahresbericht]}
});
// 16. AssessmentSheet
var assessmentSheetRightGroup = new UserRightGroup("AssessmentSheet", new Dictionary<UserRightType, string>
{
{AssessmentSheet_View, EnumTranslations.AllTranslations[AssessmentSheet_View]},
{AssessmentSheet_Edit, EnumTranslations.AllTranslations[AssessmentSheet_Edit]},
{AssessmentSheet_Create, EnumTranslations.AllTranslations[AssessmentSheet_Create]},
{AssessmentSheet_Delete, EnumTranslations.AllTranslations[AssessmentSheet_Delete]}
});
// 17. Gruppen
var groupOfPeopleRightGroup = new UserRightGroup("Gruppen", new Dictionary<UserRightType, string>
{
{GroupOfPeopleView_Edit, EnumTranslations.AllTranslations[GroupOfPeopleView_Edit]},
{GroupOfPeopleView_Create, EnumTranslations.AllTranslations[GroupOfPeopleView_Create]},
{GroupOfPeopleView_Delete, EnumTranslations.AllTranslations[GroupOfPeopleView_Delete]}
});
// 18. Mitarbeiterstundenkonto
var mitarbeiterstundenkontoRightGroup = new UserRightGroup("Mitarbeiterstundenkonto", new Dictionary<UserRightType, string>
{
{Mitarbeiterstundenkonto_ViewSelf, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewSelf]},
{Mitarbeiterstundenkonto_ViewAll, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewAll]},
{Mitarbeiterstundenkonto_ViewTeams, EnumTranslations.AllTranslations[Mitarbeiterstundenkonto_ViewTeams]}
});
// 19.
var schedulerRightGroup = new UserRightGroup("Kalender", new Dictionary<UserRightType, string>
{
{KalenderAnsehen,EnumTranslations.AllTranslations[KalenderAnsehen]},
{KalenderMitarbeitertermineAnsehen,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAnsehen]},
{KalenderMitarbeitertermineAnlegen,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAnlegen]},
{KalenderMitarbeitertermineAendern,EnumTranslations.AllTranslations[KalenderMitarbeitertermineAendern]},
{KalenderKliententermineAlleAnsehen,EnumTranslations.AllTranslations[KalenderKliententermineAlleAnsehen]},
{KalenderKliententermineAnlegen,EnumTranslations.AllTranslations[KalenderKliententermineAnlegen]},
{KalenderKliententermineAendern,EnumTranslations.AllTranslations[KalenderKliententermineAendern]},
{KalenderRessourcentermineAnsehen,EnumTranslations.AllTranslations[KalenderRessourcentermineAnsehen]},
{KalenderRessourcentermineAnlegen,EnumTranslations.AllTranslations[KalenderRessourcentermineAnlegen]},
{KalenderRessourcentermineAendern,EnumTranslations.AllTranslations[KalenderRessourcentermineAendern]},
{KalenderRessourcentermineAndererAendern,EnumTranslations.AllTranslations[KalenderRessourcentermineAndererAendern]},
{KalenderInZeiterfassungUebernehmen,EnumTranslations.AllTranslations[KalenderInZeiterfassungUebernehmen]},
{Termine_IntervalDelete,EnumTranslations.AllTranslations[Termine_IntervalDelete]}
});
// 20.
var textModuleRightGroup = new UserRightGroup("Textbausteine", new Dictionary<UserRightType, string>
{
{TextbausteineAlleAnsehen,EnumTranslations.AllTranslations[TextbausteineAlleAnsehen]},
{TextbausteineNurEigeneAnsehen,EnumTranslations.AllTranslations[TextbausteineNurEigeneAnsehen]},
{TextbausteineAlleBearbeiten,EnumTranslations.AllTranslations[TextbausteineAlleBearbeiten]},
{TextbausteineNurEigeneBearbeiten,EnumTranslations.AllTranslations[TextbausteineNurEigeneBearbeiten]}
});
// 21.
var cashManagingRightGroup = new UserRightGroup("Bargeldverwaltung", new Dictionary<UserRightType, string>
{
{BargeldverwaltungAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungAnsehen]},
{BargeldverwaltungNurEigeneAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungNurEigeneAnsehen]},
{BargeldverwaltungBearbeiten,EnumTranslations.AllTranslations[BargeldverwaltungBearbeiten]},
{BargeldverwaltungAnlegen,EnumTranslations.AllTranslations[BargeldverwaltungAnlegen]},
{BargeldverwaltungLoeschen,EnumTranslations.AllTranslations[BargeldverwaltungLoeschen]},
{BargeldverwaltungFinanzenAnsehen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenAnsehen]},
{BargeldverwaltungFinanzenAnlegen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenAnlegen]},
{BargeldverwaltungFinanzenBearbeiten,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenBearbeiten]},
{BargeldverwaltungFinanzenLoeschen,EnumTranslations.AllTranslations[BargeldverwaltungFinanzenLoeschen]}
});
// 22.
var wohnheimRightGroup = new UserRightGroup("Wohnheime", new Dictionary<UserRightType, string>
{
{WohnheimView_View,EnumTranslations.AllTranslations[WohnheimView_View]},
{WohnheimView_Edit,EnumTranslations.AllTranslations[WohnheimView_Edit]},
{WohnheimView_Create,EnumTranslations.AllTranslations[WohnheimView_Create]},
{WohnheimView_Delete,EnumTranslations.AllTranslations[WohnheimView_Delete]},
{Wohnheim_AllowArchiving,EnumTranslations.AllTranslations[Wohnheim_AllowArchiving]}
});
// 23.
var assistanceKeyRightGroup = new UserRightGroup("Betreuungsschlüssel", new Dictionary<UserRightType, string>
{
{Betreuungsschluessel_View,EnumTranslations.AllTranslations[Betreuungsschluessel_View]},
{Betreuungsschluessel_Edit,EnumTranslations.AllTranslations[Betreuungsschluessel_Edit]},
{Betreuungsschluessel_Delete,EnumTranslations.AllTranslations[Betreuungsschluessel_Delete]},
{Betreuungsschluessel_Create,EnumTranslations.AllTranslations[Betreuungsschluessel_Create]}
});
// 24.
var documentRightGroup = new UserRightGroup("Dokumente", new Dictionary<UserRightType, string>
{
{DocumentsAllowViewAll,EnumTranslations.AllTranslations[DocumentsAllowViewAll]},
{DocumentsDownloadAll,EnumTranslations.AllTranslations[DocumentsDownloadAll]},
{DokumenteFinanzen,EnumTranslations.AllTranslations[DokumenteFinanzen]},
{DokumenteKlienten,EnumTranslations.AllTranslations[DokumenteKlienten]},
{DokumenteMitarbeiter,EnumTranslations.AllTranslations[DokumenteMitarbeiter]},
{DokumenteOrganisationen,EnumTranslations.AllTranslations[DokumenteOrganisationen]},
{DokumentePersonen,EnumTranslations.AllTranslations[DokumentePersonen]},
{DokumenteHilfeplaene,EnumTranslations.AllTranslations[DokumenteHilfeplaene]},
{DokumenteTeams,EnumTranslations.AllTranslations[DokumenteTeams]}
});
// 25. Sonstige
var sonstigeRightGroup = new UserRightGroup("Sonstige", new Dictionary<UserRightType, string>
{
{Support_View,EnumTranslations.AllTranslations[Support_View]},
{AdditionalService_View,EnumTranslations.AllTranslations[AdditionalService_View]},
{OvertimeView,EnumTranslations.AllTranslations[OvertimeView]},
{ChatSettings,EnumTranslations.AllTranslations[ChatSettings]},
{ChatAdminSettings,EnumTranslations.AllTranslations[ChatAdminSettings]},
{VertretungenView_View,EnumTranslations.AllTranslations[VertretungenView_View]}
});
Model.UserRightGroups.Clear();
Model.UserRightGroups.Add(universalRechteGroup);
Model.UserRightGroups.Add(serviceRecordRightGroup);
Model.UserRightGroups.Add(financeRightGroup);
Model.UserRightGroups.Add(resourceRightGroup);
Model.UserRightGroups.Add(reportRightView);
Model.UserRightGroups.Add(supportConceptRightGroup);
Model.UserRightGroups.Add(customerRightGroup);
Model.UserRightGroups.Add(organisationRightGroup);
Model.UserRightGroups.Add(personRightGroup);
Model.UserRightGroups.Add(employeeRightGroup);
Model.UserRightGroups.Add(teamRightGroup);
Model.UserRightGroups.Add(userRightGroup);
Model.UserRightGroups.Add(userGroupRightGroup);
Model.UserRightGroups.Add(administrationRightGroup);
Model.UserRightGroups.Add(analysisRightGroup);
Model.UserRightGroups.Add(assessmentSheetRightGroup);
Model.UserRightGroups.Add(groupOfPeopleRightGroup);
Model.UserRightGroups.Add(mitarbeiterstundenkontoRightGroup);
Model.UserRightGroups.Add(schedulerRightGroup);
Model.UserRightGroups.Add(textModuleRightGroup);
Model.UserRightGroups.Add(cashManagingRightGroup);
Model.UserRightGroups.Add(wohnheimRightGroup);
Model.UserRightGroups.Add(assistanceKeyRightGroup);
Model.UserRightGroups.Add(documentRightGroup);
Model.UserRightGroups.Add(sonstigeRightGroup);
Model.UserRightGroups = Model.UserRightGroups.OrderBy(urg => urg.UserRightTypes.Keys.Count).ToList();
// Verfügbare Ressourcen für die Termine
var allResources = KalenderService.GetAllResources().ToList();
var categories2Resources = new Dictionary<ValueListEntryDC, List<ResourceDC>>();
foreach(var category in allResources.Select(resource => resource.ResourceCategory))
{
categories2Resources.AddOrUpdateValueInDictionary(category, allResources.Where(resource => resource.ResourceCategory.Equals(category)).ToList());
}
Model.ResourceCategories2Resources = categories2Resources;
return View(Model);
}
[Authorize]
public string UpdateSelectedRights(string indicesString)
{
// Format: UserRightGroups-Index;Dictionary-Index
// Bei alle? UserRightGroup-Index;0
// Alle ignorieren! Es werden per JavaScript schon alle ausgesucht
var selectedUserRightTypes = new List<UserRightType>();
if(!string.IsNullOrWhiteSpace(indicesString))
{
var ids = indicesString.Split(';');
if(ids.Length > 0)
{
foreach(var id in ids)
{
if(!string.IsNullOrWhiteSpace(id))
{
var splitId = id.Split('-');
if(splitId.Length > 1)
{
if(Enum.TryParse(splitId[1], out UserRightType userRightType))
{
selectedUserRightTypes.AddIfNotIn(userRightType);
}
}
}
}
}
}
else // nichts ausgewählt. Soll das gehen oder nicht? Ja, soll gehen. Man braucht ja nicht das Recht, Rechte sich selbst vergeben zu können
{
}
var userGroups = MobileSessionFacade.LoggedInUser.UserGroups;
userGroups?.DoForEach(userGroup =>
{
});
return _LeerzeichenFuerGetMethoden;
}
[Authorize]
public string UpdateAppointmentResources(string selectedResourceOids)
{
#if !DEBUG
Logout();
return _LeerzeichenFuerGetMethoden;
#endif
if(Model == null)
{
Logout();
}
var oids = selectedResourceOids.Split(';');
Model.SelectedResources.Clear();
oids.Where(w => w.Length > 0).DoForEach(oidString =>
{
if(long.TryParse(oidString, out var oid))
{
var resource = Model.AvailableResources.FirstOrDefault(r => r.ResourceOid.HasValue && r.ResourceOid.Value.Equals(oid));
Model.SelectedResources.AddIfNotIn(resource);
}
});
return _LeerzeichenFuerGetMethoden;
}
[Authorize]
[HttpPost]
public ActionResult InsertTestAppointments(FormCollection formCollection)
{
return View("Development", Model);
}
}
public class UserRightGroup
{
public string Title { get; set; }
public Dictionary<UserRightType, UserRightTypeTranslation2IsAssigned> UserRightTypes { get; set; }
public bool AreAllChecked { get; set; }
public UserRightGroup(string title, Dictionary<UserRightType, string> userRightTypes)
{
Title = title ?? "Unbenannt";
UserRightTypes = new Dictionary<UserRightType, UserRightTypeTranslation2IsAssigned>();
userRightTypes?.DoForEach(rel =>
{
var isAssigned = MobileSessionFacade.LoggedInUser.CheckForRight(rel.Key);
var translation = rel.Value;
UserRightTypes.AddIfNotIn(new KeyValuePair<UserRightType, UserRightTypeTranslation2IsAssigned>(rel.Key, new UserRightTypeTranslation2IsAssigned(translation, isAssigned)));
});
if(userRightTypes != null)
{
AreAllChecked = MobileSessionFacade.LoggedInUser.CheckForRights(userRightTypes.Keys);
}
}
}
public struct UserRightTypeTranslation2IsAssigned
{
public bool IsAssigned { get; set; }
public string Translation { get; set; }
public UserRightTypeTranslation2IsAssigned(string translation, bool isAssigned)
{
IsAssigned = isAssigned;
Translation = translation;
}
}
}