UserRightHelper Ergänzung

+ UnitTest
This commit is contained in:
2024-08-07 15:21:59 +02:00
parent 2ff177298f
commit 0fd7946841
5 changed files with 291 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
using BS.Shared;
using BeWo.Data.Security;
using BS.Shared;
using BS.Shared.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
@@ -10,13 +11,228 @@ namespace TranslationUnitTest
public class EnumTranslationTest
{
public Dictionary<UserRightType, String> Dict { get; set; }
public List<UserRightType> UserRightTypesVersion1dot0 { get; set; }
[TestInitialize]
public void Init()
{
Dict = EnumTranslations.UserRightType2Translations;
}
UserRightTypesVersion1dot0 = new List<UserRightType>() {
UserRightType.None,
UserRightType.DeleteAll,
UserRightType.CreateAll,
UserRightType.EditAll,
UserRightType.ViewAll,
UserRightType.ServiceRecordView_View,
UserRightType.ServiceRecordView_Edit,
UserRightType.ServiceRecordView_Create,
UserRightType.ServiceRecordView_Delete,
UserRightType.AccountingTransactionView_View,
UserRightType.AccountingTransactionView_Edit,
UserRightType.AccountingTransactionView_Create,
UserRightType.AccountingTransactionView_Delete,
UserRightType.ResourceBookingView_View,
UserRightType.ResourceBookingView_Edit,
UserRightType.ResourceBookingView_Create,
UserRightType.ResourceBookingView_Delete,
UserRightType.QueryView_View,
UserRightType.QueryView_Edit,
UserRightType.QueryView_Create,
UserRightType.QueryView_Delete,
UserRightType.SupportConceptView_View,
UserRightType.SupportConceptView_Edit,
UserRightType.SupportConceptView_Create,
UserRightType.SupportConceptView_Delete,
UserRightType.CustomerView_View,
UserRightType.CustomerView_Edit,
UserRightType.CustomerView_Create,
UserRightType.CustomerView_Delete,
UserRightType.OrganisationView_View,
UserRightType.OrganisationView_Edit,
UserRightType.OrganisationView_Create,
UserRightType.OrganisationView_Delete,
UserRightType.PersonView_View,
UserRightType.PersonView_Edit,
UserRightType.PersonView_Create,
UserRightType.PersonView_Delete,
UserRightType.EmployeeView_View,
UserRightType.EmployeeView_Edit,
UserRightType.EmployeeView_Create,
UserRightType.EmployeeView_Delete,
UserRightType.TeamView_ViewAll,
UserRightType.TeamView_Edit,
UserRightType.TeamView_Create,
UserRightType.TeamView_Delete,
UserRightType.UserView_View,
UserRightType.UserView_Edit,
UserRightType.UserView_Create,
UserRightType.UserView_Delete,
UserRightType.UserGroupView_View,
UserRightType.UserGroupView_Edit,
UserRightType.UserGroupView_Create,
UserRightType.UserGroupView_Delete,
UserRightType.AdministrationView_View,
UserRightType.AdministrationView_Edit,
UserRightType.AdministrationView_Create,
UserRightType.AdministrationView_Delete,
UserRightType.Employee_ShowFinance,
UserRightType.Analysis_Settlement_View,
UserRightType.Analysis_EmployeeOverviewAll_View,
UserRightType.Analysis_ServiceOverview_View,
UserRightType.Analysis_SupportConceptOverviewAll_View,
UserRightType.UserView_AllowChangePassword,
UserRightType.OrganisationView_AllowEditCostBearer,
UserRightType.ServiceRecord_AllowChangeWithin24Hours,
UserRightType.ServiceRecord_AllowCreateServiceRecordsForAllClients,
UserRightType.SupportConcept_ViewAllSupportConcepts,
UserRightType.SupportConcept_AllowGoalOrientedSupportConcepts,
UserRightType.Customer_ViewMyCustomers,
UserRightType.Analysis_AllowFLSOverviewForCostbearer,
UserRightType.SupportConceptView_AllowArchiving,
UserRightType.Person_AllowArchiving,
UserRightType.Customer_AllowArchiving,
UserRightType.ServiceRecord_AllowCreationForOtherEmployees,
UserRightType.ResourceBookingView_AllowEditResourcesFromOtherEmployees,
UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth,
UserRightType.AssessmentSheet_View,
UserRightType.AssessmentSheet_Edit,
UserRightType.AssessmentSheet_Create,
UserRightType.AssessmentSheet_Delete,
UserRightType.ServiceRecord_AllowCreateMoreFLSThanApproved,
UserRightType.Analysis_AuslastungAllEmployee_View,
UserRightType.Analysis_AuslastungTeam_View,
UserRightType.Analysis_Auslastung_View,
UserRightType.Analysis_AllowFLSOverviewForTeam,
UserRightType.Analysis_AllowFLSOverviewForAllTeams,
UserRightType.ServiceRecord_AllowCreateOverlappingFLS,
UserRightType.ServiceRecord_AllowCreationForOtherTeamMember,
UserRightType.BookServiceRecordOutOfSupportConcept,
UserRightType.BookServiceRecordAfterSettlementInvoice,
UserRightType.Organisation_AllowArchiving,
UserRightType.ServiceRecord_ShowHistory,
UserRightType.ServiceRecord_AllowCreateOverlappingFLSForEmployee,
UserRightType.ServiceRecord_AllowCreatingGroupBooking,
UserRightType.ServiceRecord_AllowCreatingMultiBooking,
UserRightType.TeamView_ViewMyTeams,
UserRightType.Customer_ViewMyTeams,
UserRightType.SupportConcept_ViewMyTeams,
UserRightType.Employee_AllowEditExtendedProperties,
UserRightType.Employee_AllowEditContracts,
UserRightType.Employee_AllowEditOwnEmployees,
UserRightType.Employee_AllowArchiving,
UserRightType.User_AllowOrderLicense,
UserRightType.Employee_AllowViewOwnEmployees,
UserRightType.Employee_AllowViewOwnTeam,
UserRightType.Employee_ViewNotizen,
UserRightType.Employee_EditNotizen,
UserRightType.Employee_DeleteNotizen,
UserRightType.GroupOfPeopleView_Edit,
UserRightType.GroupOfPeopleView_Create,
UserRightType.GroupOfPeopleView_Delete,
UserRightType.AdditionalService_View,
UserRightType.OvertimeView,
UserRightType.Mitarbeiterstundenkonto_ViewSelf,
UserRightType.Mitarbeiterstundenkonto_ViewAll,
UserRightType.Mitarbeiterstundenkonto_ViewTeams,
UserRightType.Auswertungen_BerichteAnsehen,
UserRightType.Auswertungen_StundenuebersichtAnsehen,
UserRightType.Auswertungen_HilfeplanuebersichtAnsehen,
UserRightType.Support_View,
UserRightType.SupportConcept_AllowEditGoals,
UserRightType.SupportConcept_AllowEditTasks,
UserRightType.ServiceRecord_AllowEditForOtherEmployees,
UserRightType.KalenderAnsehen,
UserRightType.KalenderMitarbeitertermineAnsehen,
UserRightType.KalenderMitarbeitertermineAnlegen,
UserRightType.KalenderMitarbeitertermineAendern,
UserRightType.KalenderKliententermineAlleAnsehen,
UserRightType.KalenderKliententermineAnlegen,
UserRightType.KalenderKliententermineAendern,
UserRightType.KalenderRessourcentermineAnsehen,
UserRightType.KalenderRessourcentermineAnlegen,
UserRightType.KalenderRessourcentermineAendern,
UserRightType.KalenderRessourcentermineAndererAendern,
UserRightType.KalenderInZeiterfassungUebernehmen,
UserRightType.AllowChangeOwnPassword,
UserRightType.TextbausteineAlleAnsehen,
UserRightType.TextbausteineNurEigeneAnsehen,
UserRightType.TextbausteineAlleBearbeiten,
UserRightType.TextbausteineNurEigeneBearbeiten,
UserRightType.BargeldverwaltungAnsehen,
UserRightType.BargeldverwaltungNurEigeneAnsehen,
UserRightType.BargeldverwaltungBearbeiten,
UserRightType.BargeldverwaltungAnlegen,
UserRightType.BargeldverwaltungLoeschen,
UserRightType.SupportConceptAllowReactivation,
UserRightType.CustomerAllowReactivation,
UserRightType.OrganisationAllowReactivation,
UserRightType.PersonAllowReactivation,
UserRightType.EmployeeAllowReactivation,
UserRightType.ServiceRecordAllowRebooking,
UserRightType.CostbearerAllowChange,
UserRightType.ServiceRecordAllowEditAfterMindays,
UserRightType.DocumentsAllowViewAll,
UserRightType.DocumentsDownloadAll,
UserRightType.DocumentsEditFolders,
UserRightType.DocumentsUploadAll,
UserRightType.DocumentsDeleteAll,
UserRightType.Customer_ViewMedication,
UserRightType.Customer_ViewDiagnosis,
UserRightType.Customer_ViewNotizen,
UserRightType.Customer_EditNotizen,
UserRightType.Customer_DeleteNotizen,
UserRightType.WohnheimView_View,
UserRightType.WohnheimView_Edit,
UserRightType.WohnheimView_Create,
UserRightType.WohnheimView_Delete,
UserRightType.Wohnheim_AllowArchiving,
UserRightType.Betreuungsschluessel_View,
UserRightType.Betreuungsschluessel_Edit,
UserRightType.Betreuungsschluessel_Delete,
UserRightType.Betreuungsschluessel_Create,
UserRightType.Jahresbericht,
UserRightType.DokumenteFinanzen,
UserRightType.DokumenteKlienten,
UserRightType.DokumenteMitarbeiter,
UserRightType.DokumenteOrganisationen,
UserRightType.DokumentePersonen,
UserRightType.DokumenteHilfeplaene,
UserRightType.DokumenteTeams,
UserRightType.BargeldverwaltungFinanzenAnsehen,
UserRightType.BargeldverwaltungFinanzenAnlegen,
UserRightType.BargeldverwaltungFinanzenBearbeiten,
UserRightType.BargeldverwaltungFinanzenLoeschen,
UserRightType.ChatSettings,
UserRightType.ChatAdminSettings,
UserRightType.Kilometerauswertung_View,
UserRightType.BewertungAuswertung_View,
UserRightType.BewertenInZeiterfassung,
UserRightType.PivotTabelleAnsehen,
UserRightType.DienstplanungAnsehen,
UserRightType.AbwesenheitsPlanungAnsehen,
UserRightType.KilometerauswertungEigene_View,
UserRightType.VertretungenView_View,
UserRightType.CustomerTeam_View,
UserRightType.CustomerTeam_Edit,
UserRightType.CustomerTeam_Delete,
UserRightType.CustomerTeam_Create,
UserRightType.Person_FamilyView,
UserRightType.Customer_Anonymization,
UserRightType.Customer_Full_Delete,
UserRightType.Person_Full_Delete,
UserRightType.Employee_Full_Delete,
UserRightType.Employee_Anonymization,
UserRightType.Termine_IntervalDelete,
UserRightType.ServiceRecord_AllowCreateAfterEmployeeSignature,
UserRightType.ServiceRecord_AllowEditAfterEmployeeSignature,
UserRightType.ServiceRecord_AllowDeleteAfterEmployeeSignature,
UserRightType.ConfirmationReceiptSignatures_Delete,
UserRightType.Signature_ProvideSingleSignature,
UserRightType.Signature_ProvideMonthlySignature,
UserRightType.Signature_ProvideMonthlySignatureByProxy,
};
}
[TestMethod]
public void DictionaryCreation()
@@ -42,5 +258,24 @@ namespace TranslationUnitTest
Assert.Fail($"UserRight \"{item}\" hat keine Übersetzung in {nameof(EnumTranslations.UserRightType2Translations)}");
}
}
[TestMethod]
public void UserRightHelperComplete()
{
foreach (UserRightType item in Enum.GetValues(typeof(UserRightType)))
{
var has_base_version = UserRightHelper.GetRightVersion(item) == UserRightHelper.BASE_VERSION;
if (!has_base_version)
continue;
var is_base_version = UserRightTypesVersion1dot0.Contains(item);
if (is_base_version)
continue;
Assert.Fail($"UserRight \"{item}\" hat keine Versionierung in {nameof(UserRightHelper.GetRightVersion)} ({nameof(UserRightHelper)})");
}
}
}
}

View File

@@ -56,6 +56,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Data.csproj">
<Project>{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}</Project>
<Name>Data</Name>
</ProjectReference>
<ProjectReference Include="..\Shared\Shared.csproj">
<Project>{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}</Project>
<Name>Shared</Name>