From e256ed478ef25598949113c29a337b33cf25123e Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 12 Feb 2024 14:25:32 +0100 Subject: [PATCH 01/17] migration to BEXIS v3 #240 --- BExIS.Modules.RBM.UI.csproj | 120 +++++++++------- BExIS.Rbm.Entities/BExIS.Rbm.Entities.csproj | 9 +- BExIS.Rbm.Orm.NH/BExIS.Rbm.Orm.NH.csproj | 2 +- BExIS.Rbm.Services/BExIS.Rbm.Services.csproj | 18 +-- BExIS.Rbm.Services/app.config | 24 ++-- Controllers/NotificationController.cs | 4 +- Controllers/ScheduleController.cs | 21 ++- Helper/SendNotificationHelper.cs | 12 +- Helper/Settings.cs | 134 ------------------ Properties/Settings.Designer.cs | 2 +- Rbm.Settings.json | 78 +++++++++++ web.config | 138 +++++++------------ 12 files changed, 249 insertions(+), 313 deletions(-) delete mode 100644 Helper/Settings.cs create mode 100644 Rbm.Settings.json diff --git a/BExIS.Modules.RBM.UI.csproj b/BExIS.Modules.RBM.UI.csproj index 64e50c5..a3917b7 100644 --- a/BExIS.Modules.RBM.UI.csproj +++ b/BExIS.Modules.RBM.UI.csproj @@ -19,7 +19,7 @@ Properties BExIS.Modules.RBM.UI BExIS.Modules.RBM.UI - v4.5.2 + v4.8 false true @@ -32,6 +32,7 @@ ..\..\..\..\packages\WebGrease.1.5.2\lib 3.1 + true @@ -71,13 +72,17 @@ - + ..\..\..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + + + + ..\..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll @@ -105,56 +110,14 @@ ..\..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - + ..\..\..\..\packages\TelerikMvcExtensions.2013.2.611\lib\net40\Telerik.Web.Mvc.dll - - ..\..\..\..\Libraries\Vaiona\Vaiona.Core.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Entities.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Entities.Orm.NH.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.IoC.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Logging.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Model.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.MultiTenancy.Api.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.MultiTenancy.Services.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Persistence.Api.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.PersistenceProviders.NH.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Utils.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.Mvc.dll - - - ..\..\..\..\Libraries\Vaiona\Vaiona.Web.Mvc.Modularity.dll - ..\..\..\..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll @@ -186,7 +149,6 @@ - @@ -668,6 +630,9 @@ + + Always + PublicSettingsSingleFileGenerator @@ -705,11 +670,11 @@ - {C230693B-D780-438B-B26C-82257642DD5C} + {c230693b-d780-438b-b26c-82257642dd5c} BExIS.Security.Entities - {681C8BC4-55F0-4F43-A685-90E246A88CB1} + {681c8bc4-55f0-4f43-a685-90e246a88cb1} BExIS.Security.Services @@ -720,6 +685,62 @@ {C4CA0A99-0AF3-4372-A9B7-B9073599BD8B} BExIS.Dlm.Services + + {b446c14f-9df1-4c3c-a634-e3addd05c48a} + Vaiona.Core + + + {c4d4bc9e-8832-4966-be58-cb684e9a74e8} + Vaiona.Entities.Orm.NH + + + {0815d220-3625-4e23-bbbc-8152345637fe} + Vaiona.Entities + + + {29a7be0f-a17c-4ae8-8ca1-15fe4dd74129} + Vaiona.IoC + + + {e8b37581-1cac-463d-903b-b4bee8b2b0e3} + Vaiona.Logging + + + {a60ac05f-8c9a-4efd-9826-452e6049da4d} + Vaiona.Model + + + {bccd3d7b-8a50-4fa2-b9d3-2cb31bea60b3} + Vaiona.MultiTenancy.Api + + + {4639d130-e0aa-4aef-b9bd-bef6ad99dbaf} + Vaiona.MultiTenancy.Services + + + {640bf81d-354a-4bf0-85fc-f0ad587cf8a2} + Vaiona.Persistence.Api + + + {2fb8def8-5749-4eae-8588-8a5aaed251a5} + Vaiona.PersistenceProviders.NH + + + {63fcacaa-9534-4fdd-a082-78dcc06baf28} + Vaiona.Utils + + + {705f8751-e58a-453e-a7fd-0c310fd3cae8} + Vaiona.Web.Mvc.Modularity + + + {5f5d22e8-8c05-49cd-854e-8fe8eff1aa6c} + Vaiona.Web.Mvc + + + {5b48b5a8-eae8-4ef8-8f2c-7fedb1b095d3} + Vaiona.Web + {252f7872-a69c-43a6-84b4-4d2abdbdd9ab} BExIS.Xml.Helpers @@ -791,7 +812,8 @@ mkdir "$(SolutionDir)Console\Workspace\Modules\RBM" -C:\Windows\System32\xcopy "$(ProjectDir)Rbm.Settings.xml" "$(SolutionDir)Console\Workspace\Modules\RBM" /C /Y /I +C:\Windows\System32\xcopy "$(ProjectDir)Rbm.Settings.json" "$(SolutionDir)Console\Workspace\Modules\RBM" /C /Y /I + - - - + + - - + + - - - - - - - - - - - - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - - - - - + + - - + + - - + + - - + + - - - - - - + + - - - + - - - - + + + + - + + \ No newline at end of file From f38bb6fc6819c648e1d8e33f2fec81a64ca111a8 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Tue, 24 Sep 2024 16:13:13 +0200 Subject: [PATCH 02/17] pub profile for v3 --- BExIS.Modules.RBM.UI.csproj | 1 + .../BexisServer_2030-testsite.pubxml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Properties/PublishProfiles/BexisServer_2030-testsite.pubxml diff --git a/BExIS.Modules.RBM.UI.csproj b/BExIS.Modules.RBM.UI.csproj index a3917b7..4fa386e 100644 --- a/BExIS.Modules.RBM.UI.csproj +++ b/BExIS.Modules.RBM.UI.csproj @@ -633,6 +633,7 @@ Always + PublicSettingsSingleFileGenerator diff --git a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml new file mode 100644 index 0000000..7b9b929 --- /dev/null +++ b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml @@ -0,0 +1,18 @@ + + + + + FileSystem + FileSystem + Release + Any CPU + + True + False + Y:\RBM + False + + \ No newline at end of file From 08dcbd242db67a710840887766f6eb8ec97881f4 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Wed, 25 Sep 2024 13:47:27 +0200 Subject: [PATCH 03/17] pub profile --- Properties/PublishProfiles/BexisServer_2030-testsite.pubxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml index 7b9b929..db8b727 100644 --- a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml +++ b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml @@ -12,7 +12,7 @@ indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Si True False - Y:\RBM + Y:\Site\Areas\RBM False \ No newline at end of file From e1da5d9f89cab458d8b7efc11dd807832763ac37 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Fri, 27 Sep 2024 14:24:23 +0200 Subject: [PATCH 04/17] pub --- Properties/PublishProfiles/BexisServer_2030-testsite.pubxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml index db8b727..c2c9d94 100644 --- a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml +++ b/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml @@ -12,7 +12,7 @@ indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Si True False - Y:\Site\Areas\RBM + C:\inetpub\wwwroot\2030-TestSite\Site\Areas\RBM False \ No newline at end of file From 14d1f4c099be797d65dc9407a11e538e21bc063c Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 14 Oct 2024 11:01:10 +0200 Subject: [PATCH 05/17] EntityPermissionManager async in version 3.4.0 --- Controllers/ActivityController.cs | 6 ++-- Controllers/NotificationController.cs | 20 +++++++------- Controllers/ResourceController.cs | 8 +++--- Controllers/ResourceStructureController.cs | 16 +++++------ Controllers/ScheduleController.cs | 32 +++++++++++----------- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Controllers/ActivityController.cs b/Controllers/ActivityController.cs index d8d35ea..3b487ee 100644 --- a/Controllers/ActivityController.cs +++ b/Controllers/ActivityController.cs @@ -42,8 +42,8 @@ public ActionResult Activity() // temp.InUse = rManager.IsInEvent(a.Id); // get permission from logged in user - temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List { entityTypeId }, a.Id, RightType.Read); - temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List { entityTypeId }, a.Id, RightType.Delete); + temp.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, a.Id, RightType.Read).Result; + temp.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, a.Id, RightType.Delete).Result; model.Add(temp); } @@ -88,7 +88,7 @@ public ActionResult Create(ActivityModel model) // 31 is the sum from all rights: Read = 1, Write = 4, Delete = 8, Grant = 16 int rights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant; - pManager.Create(user, entityType, a.Id, rights); + //pManager.CreateAsync(user.Name, entityType.Name, a.Id, rights); // End -> add security ------------------------------------------ } diff --git a/Controllers/NotificationController.cs b/Controllers/NotificationController.cs index f915590..3fda902 100644 --- a/Controllers/NotificationController.cs +++ b/Controllers/NotificationController.cs @@ -49,8 +49,8 @@ public ActionResult Notification() NotificationModel temp = new NotificationModel(n); //get permission from logged in user - temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, n.Id, RightType.Write); - temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, n.Id, RightType.Delete); + temp.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, n.Id, RightType.Write).Result; + temp.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, n.Id, RightType.Delete).Result; model.Add(temp); } @@ -197,8 +197,8 @@ public ActionResult Save(EditNotificationModel model) var group = groupManager.FindByNameAsync(g).Result; if (group != null) { - if (pManager.GetRights(group.Id, entityType.Id, notification.Id) == 0) - pManager.Create(group.Id, entityType.Id, notification.Id, fullRights); + if (pManager.GetRightsAsync(group.Id, entityType.Id, notification.Id).Result == 0) + pManager.CreateAsync(group.Id, entityType.Id, notification.Id, fullRights); } } } @@ -208,8 +208,8 @@ public ActionResult Save(EditNotificationModel model) using (var groupManager = new GroupManager()) { var adminGroup = groupManager.FindByNameAsync("administrator").Result; - if (pManager.GetRights(adminGroup.Id, entityType.Id, notification.Id) == 0) - pManager.Create(adminGroup.Id, entityType.Id, notification.Id, fullRights); + if (pManager.GetRightsAsync(adminGroup.Id, entityType.Id, notification.Id).Result == 0) + pManager.CreateAsync(adminGroup.Id, entityType.Id, notification.Id, fullRights); } @@ -217,7 +217,7 @@ public ActionResult Save(EditNotificationModel model) var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; - pManager.Create(user, entityType, notification.Id, fullRights); + pManager.CreateAsync(user, entityType, notification.Id, fullRights); //End -> add security ------------------------------------------ @@ -385,7 +385,7 @@ public ActionResult Delete(long id) { Type entityType = entityTypeManager.FindByName("Notification").EntityType; //delete security - permissionManager.Delete(entityType, id); + permissionManager.DeleteAsync (entityType, id); } } @@ -444,8 +444,8 @@ public ActionResult Notification_Select() NotificationModel temp = new NotificationModel(n); //get permission from logged in user - temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, n.Id, RightType.Write); - temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, n.Id, RightType.Delete); + temp.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, n.Id, RightType.Write).Result; + temp.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, n.Id, RightType.Delete).Result; notifications.Add(temp); } diff --git a/Controllers/ResourceController.cs b/Controllers/ResourceController.cs index 1d75a1a..6f902d4 100644 --- a/Controllers/ResourceController.cs +++ b/Controllers/ResourceController.cs @@ -63,8 +63,8 @@ public ActionResult Resource() //get permission from logged in user - temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entity.Id }, r.Id, RightType.Write); - temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entity.Id }, r.Id, RightType.Delete); + temp.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entity.Id, r.Id, RightType.Write).Result; + temp.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entity.Id, r.Id, RightType.Delete).Result; model.Add(temp); } @@ -244,7 +244,7 @@ public ActionResult Save() //31 is the sum from all rights: Read = 1, Write = 4, Delete = 8, Grant = 16 int rights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant; - pManager.Create(user, entityType, resource.Id, rights); + pManager.CreateAsync(user, entityType, resource.Id, rights); } //End -> add security ------------------------------------------ @@ -649,7 +649,7 @@ public ActionResult Delete(long id) { Type entityType = entityTypeManager.FindByName("SingleResource").EntityType; //delete security - permissionManager.Delete(entityType, id); + permissionManager.DeleteAsync(entityType, id); } } diff --git a/Controllers/ResourceStructureController.cs b/Controllers/ResourceStructureController.cs index b3b2a9e..21c251c 100644 --- a/Controllers/ResourceStructureController.cs +++ b/Controllers/ResourceStructureController.cs @@ -48,8 +48,8 @@ public ActionResult ResourceStructure() temp.InUse = rsManager.IsResourceStructureInUse(rs.Id); //get permission from logged in user - temp.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, rs.Id, RightType.Write); - temp.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, rs.Id, RightType.Delete); + temp.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, rs.Id, RightType.Write).Result; + temp.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, rs.Id, RightType.Delete).Result; model.Add(temp); } @@ -90,7 +90,7 @@ public ActionResult Create(CreateResourceStructureModel model) //31 is the sum from all rights: Read = 1, Write = 4, Delete = 8, Grant = 16 int rights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant; - pManager.Create(user, entityType, rS.Id, rights); + pManager.CreateAsync(user, entityType, rS.Id, rights); //End -> add security ------------------------------------------ @@ -218,7 +218,7 @@ public ActionResult Delete(long id) { Type entityType = entityTypeManager.FindByName("ResourceStructure").EntityType; //delete security - permissionManager.Delete(entityType, id); + permissionManager.DeleteAsync(entityType, id); } } @@ -299,8 +299,8 @@ public ActionResult ResourceStructureAttribute() long entityTypeId = entityTypeManager.FindByName("ResourceStructureAttribute").Id; //get permission from logged in user - rsaModel.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, a.Id, RightType.Write); - rsaModel.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entityTypeId }, a.Id, RightType.Delete); + rsaModel.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, a.Id, RightType.Write).Result; + rsaModel.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entityTypeId, a.Id, RightType.Delete).Result; model.Add(rsaModel); } } @@ -384,7 +384,7 @@ public ActionResult SaveResourceStructureAttribute(EditResourceStructureAttribut Entity entityType = entityTypeManager.FindByName("ResourceStructureAttribute"); - pManager.Create(user, entityType, rsa.Id, 31); + pManager.CreateAsync(user, entityType, rsa.Id, 31); } //End -> add security ------------------------------------------ @@ -494,7 +494,7 @@ public ActionResult DeleteResourceStructureAttribute(long id) { Type entityType = entityTypeManager.FindByName("Notification").EntityType; //delete security - permissionManager.Delete(entityType, id); + permissionManager.DeleteAsync (entityType, id); } } else diff --git a/Controllers/ScheduleController.cs b/Controllers/ScheduleController.cs index c87fa6d..70edb07 100644 --- a/Controllers/ScheduleController.cs +++ b/Controllers/ScheduleController.cs @@ -827,8 +827,8 @@ public ActionResult SaveEvent() var group = groupManager.FindByNameAsync(g).Result; if (group != null) { - if (permissionManager.GetRights(group.Id, entityTypeEvent.Id, eEvent.Id) == 0) - permissionManager.Create(group.Id, entityTypeEvent.Id, eEvent.Id, fullRights); + if (permissionManager.GetRightsAsync(group.Id, entityTypeEvent.Id, eEvent.Id).Result == 0) + permissionManager.CreateAsync(group.Id, entityTypeEvent.Id, eEvent.Id, fullRights); } } } @@ -837,8 +837,8 @@ public ActionResult SaveEvent() //rights on event for logdedin user var userIdLoggedIn = UserHelper.GetUserId(HttpContext.User.Identity.Name); - if (permissionManager.GetRights(userIdLoggedIn, entityTypeEvent.Id, eEvent.Id) == 0) - permissionManager.Create(userIdLoggedIn, entityTypeEvent.Id, eEvent.Id, fullRights); + if (permissionManager.GetRightsAsync(userIdLoggedIn, entityTypeEvent.Id, eEvent.Id).Result == 0) + permissionManager.CreateAsync(userIdLoggedIn, entityTypeEvent.Id, eEvent.Id, fullRights); List notifications = new List(); @@ -922,8 +922,8 @@ public ActionResult SaveEvent() if (group != null) { //rights on schedule - if (permissionManager.GetRights(group.Id, entityTypeSchedule.Id, newSchedule.Id) == 0) - permissionManager.Create(group.Id, entityTypeSchedule.Id, newSchedule.Id, fullRights); + if (permissionManager.GetRightsAsync(group.Id, entityTypeSchedule.Id, newSchedule.Id).Result == 0) + permissionManager.CreateAsync(group.Id, entityTypeSchedule.Id, newSchedule.Id, fullRights); } } } @@ -931,8 +931,8 @@ public ActionResult SaveEvent() //add rights to logged in user if not exsit //rights on schedule 31 is the sum from all rights: Read = 1, Write = 4, Delete = 8, Grant = 16 - if (permissionManager.GetRights(userIdLoggedIn, entityTypeSchedule.Id, newSchedule.Id) == 0) - permissionManager.Create(userIdLoggedIn, entityTypeSchedule.Id, newSchedule.Id, fullRights); + if (permissionManager.GetRightsAsync(userIdLoggedIn, entityTypeSchedule.Id, newSchedule.Id).Result == 0) + permissionManager.CreateAsync(userIdLoggedIn, entityTypeSchedule.Id, newSchedule.Id, fullRights); //Add rights to the schedule and event for all user reserved for foreach (PersonInSchedule user in schedule.ForPersons) @@ -942,12 +942,12 @@ public ActionResult SaveEvent() { //rights on schedule 15 is the sum from this rights: Read = 1, Download = 2, Write = 4, Delete = 8 int schedulesRights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete; - if (permissionManager.GetRights(us.Id, entityTypeSchedule.Id, newSchedule.Id) == 0) - permissionManager.Create(us.Id, entityTypeSchedule.Id, newSchedule.Id, schedulesRights); + if (permissionManager.GetRightsAsync(us.Id, entityTypeSchedule.Id, newSchedule.Id).Result == 0) + permissionManager.CreateAsync(us.Id, entityTypeSchedule.Id, newSchedule.Id, schedulesRights); //rights on event, Read = 1, Write = 4 int eventRights = (int)RightType.Read + (int)RightType.Write; - if (permissionManager.GetRights(us.Id, entityTypeEvent.Id, eEvent.Id) == 0) - permissionManager.Create(us.Id, entityTypeEvent.Id, eEvent.Id, eventRights); + if (permissionManager.GetRightsAsync(us.Id, entityTypeEvent.Id, eEvent.Id).Result == 0) + permissionManager.CreateAsync(us.Id, entityTypeEvent.Id, eEvent.Id, eventRights); } } } @@ -2098,14 +2098,14 @@ public ActionResult Show(long id) //Check permission for BookingEvent Entity entity = entityTypeManager.FindByName("BookingEvent"); - model.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entity.Id }, id, RightType.Write); - model.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entity.Id }, id, RightType.Delete); + model.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entity.Id, id, RightType.Write).Result; + model.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entity.Id , id, RightType.Delete).Result; //Check permission for Schedule Entity entity2 = entityTypeManager.FindByName("Schedule"); - model.Schedules.ForEach(a => a.EditAccess = permissionManager.HasEffectiveRight(userId, new List() { entity2.Id }, a.ScheduleId, RightType.Write)); - model.Schedules.ForEach(a => a.DeleteAccess = permissionManager.HasEffectiveRight(userId, new List() { entity2.Id }, a.ScheduleId, RightType.Delete)); + model.Schedules.ForEach(a => a.EditAccess = permissionManager.HasEffectiveRightsAsync(userId, entity2.Id, a.ScheduleId, RightType.Write).Result); + model.Schedules.ForEach(a => a.DeleteAccess = permissionManager.HasEffectiveRightsAsync(userId, entity2.Id , a.ScheduleId, RightType.Delete).Result); //Set Edit access foreach (var s in model.Schedules) From 97cbf03823871432b0609f853724ac23e96d7884 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 14 Oct 2024 11:01:29 +0200 Subject: [PATCH 06/17] EntityPermissionManager async in version 3.4.0 --- Helper/RbmSeedDataGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helper/RbmSeedDataGenerator.cs b/Helper/RbmSeedDataGenerator.cs index c51c118..a3f663c 100644 --- a/Helper/RbmSeedDataGenerator.cs +++ b/Helper/RbmSeedDataGenerator.cs @@ -323,7 +323,7 @@ public void GenerateSeedData() var resource = rManager.CreateResource(rs_item.name, rs_item.description, rs_item.quantity, rs_item.color, rs_item.withActivity, rs_item.resourceStructure, duration); //add entity rights - permissionManager.Create(adminGroup, + permissionManager.CreateAsync (adminGroup, entityManager.FindByName("SingleResource"), resource.Id, rights From 455a00f4489db87d8ede2048d411d098fd98ac2e Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 18 Nov 2024 09:26:30 +0100 Subject: [PATCH 07/17] bug if resource of which one has no copied files but the other has is fixed #243 --- Controllers/ScheduleController.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Controllers/ScheduleController.cs b/Controllers/ScheduleController.cs index 70edb07..6669141 100644 --- a/Controllers/ScheduleController.cs +++ b/Controllers/ScheduleController.cs @@ -1612,9 +1612,12 @@ public ActionResult UseValuesForAllSchedules(string index) if(s.ResourceHasFiles) { - if(s.Files.FirstOrDefault().Name == tempSchedule.Files.FirstOrDefault().Name) + if (tempSchedule.Files.Count > 0) { - s.FileConfirmation = true; + if (s.Files.FirstOrDefault().Name == tempSchedule.Files.FirstOrDefault().Name) + { + s.FileConfirmation = true; + } } } From 4c85ef0a46664401e41e3296a690d88934a0f8af Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Thu, 5 Dec 2024 13:13:41 +0100 Subject: [PATCH 08/17] email service update --- Helper/SendNotificationHelper.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Helper/SendNotificationHelper.cs b/Helper/SendNotificationHelper.cs index 13bb2a8..e2259c0 100644 --- a/Helper/SendNotificationHelper.cs +++ b/Helper/SendNotificationHelper.cs @@ -30,8 +30,10 @@ public static void SendNotification(List receiver, string message, strin List receiverBCC = new List(); receiverBCC.Add(ConfigurationManager.AppSettings["SystemEmail"]); - var emailService = new EmailService(); - emailService.Send(subject, message, receiver, null, receiverBCC, null); + using (var emailService = new EmailService()) + { + emailService.Send(subject, message, receiver, null, receiverBCC, null); + } } /// @@ -94,14 +96,16 @@ public static void SendBookingNotification(BookingAction bookingAction, BookingE receiverBCC.Add(ConfigurationManager.AppSettings["SystemEmail"].ToString()); // Allways send BCC to SystemEmail - var emailService = new EmailService(); - emailService.Send( - subject, - message, - receiver.Distinct().ToList(), - receiverCC, - receiverBCC - ); + using (var emailService = new EmailService()) + { + emailService.Send( + subject, + message, + receiver.Distinct().ToList(), + receiverCC, + receiverBCC + ); + } } } From ca11b2b7ea7d690d665831e8ecc9eb3b07b1a224 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Wed, 21 Jan 2026 10:29:56 +0100 Subject: [PATCH 09/17] add publish profile for v4 prod test https://github.com/bexis/BExIS-intern/issues/804 --- .../BexisServer_v4-ProdTestsite.pubxml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml diff --git a/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml b/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml new file mode 100644 index 0000000..9eae323 --- /dev/null +++ b/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml @@ -0,0 +1,18 @@ + + + + + FileSystem + FileSystem + Release + Any CPU + + True + False + C:\inetpub\wwwroot\v4-ProdTestsite\Site\Areas\RBM + False + + \ No newline at end of file From 79c3ca06012780def88ed5a0b57bfc95b3454385 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 2 Feb 2026 16:25:31 +0100 Subject: [PATCH 10/17] add PublishProfile --- BExIS.Modules.RBM.UI.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/BExIS.Modules.RBM.UI.csproj b/BExIS.Modules.RBM.UI.csproj index 4fa386e..7428c55 100644 --- a/BExIS.Modules.RBM.UI.csproj +++ b/BExIS.Modules.RBM.UI.csproj @@ -634,6 +634,7 @@ Always + PublicSettingsSingleFileGenerator From 8ab8e1f6d5ca98e9ee06fb3e41a3126842d8fdd6 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Wed, 29 Apr 2026 12:24:34 +0200 Subject: [PATCH 11/17] Change security manager calls for B2 v4.3.0 #248 --- Controllers/ActivityController.cs | 13 +++-- Controllers/NotificationController.cs | 35 ++++++++----- Controllers/ResourceController.cs | 30 ++++++----- Controllers/ResourceStructureController.cs | 24 +++++---- Controllers/ScheduleController.cs | 61 +++++++++------------- Helper/RbmSeedDataGenerator.cs | 18 +++++-- Helper/SendNotificationHelper.cs | 15 +++++- Helper/UserHelper.cs | 13 ++--- Models/Booking/BookingEventModel.cs | 41 ++++++++------- 9 files changed, 141 insertions(+), 109 deletions(-) diff --git a/Controllers/ActivityController.cs b/Controllers/ActivityController.cs index 3b487ee..8dc5fdb 100644 --- a/Controllers/ActivityController.cs +++ b/Controllers/ActivityController.cs @@ -19,15 +19,21 @@ namespace BExIS.Modules.RBM.UI.Controllers { public class ActivityController : Controller { + private readonly UserManager _userManager; + public ActivityController(UserManager userManager) + { + _userManager = userManager; + } + public ActionResult Activity() { ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Activities", Session.GetTenant()); List model = new List(); using (var rManager = new ActivityManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); List data = rManager.GetAllActivities().ToList(); // get id from loged in user @@ -75,12 +81,11 @@ public ActionResult Create(ActivityModel model) Activity a = aManager.CreateActivity(model.Name, model.Description, model.Disable); // Start -> add security ---------------------------------------- - using (EntityPermissionManager pManager = new EntityPermissionManager()) using (SubjectManager subManager = new SubjectManager()) using (var entityTypeManager = new EntityManager()) - using (UserManager userManager = new UserManager()) { - var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); + EntityPermissionManager pManager = new EntityPermissionManager(); + var userTask = _userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; diff --git a/Controllers/NotificationController.cs b/Controllers/NotificationController.cs index 3fda902..d59de19 100644 --- a/Controllers/NotificationController.cs +++ b/Controllers/NotificationController.cs @@ -26,6 +26,18 @@ namespace BExIS.Modules.RBM.UI.Controllers { public class NotificationController : Controller { + private readonly GroupManager _groupManager; + private readonly UserManager _userManager; + + public NotificationController(GroupManager groupManager) + { + _groupManager = groupManager; + } + public NotificationController(UserManager userManager) + { + _userManager = userManager; + } + #region Notification Management public ActionResult Notification() @@ -34,9 +46,9 @@ public ActionResult Notification() List model = new List(); using (var nManager = new NotificationManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); List data = nManager.GetAllNotifications().ToList(); //get id from loged in user @@ -77,10 +89,9 @@ public ActionResult CreateNotification() public ActionResult Save(EditNotificationModel model) { using (NotificationManager nManager = new NotificationManager()) - using (EntityPermissionManager pManager = new EntityPermissionManager()) using (EntityManager entityTypeManager = new EntityManager()) - using (UserManager userManager = new UserManager()) { + EntityPermissionManager pManager = new EntityPermissionManager(); Dictionary> dictionary = (Dictionary>)Session["ResourceFilter"]; if (ModelState.IsValid && dictionary != null) { @@ -190,31 +201,27 @@ public ActionResult Save(EditNotificationModel model) .Where(pair => values.Contains(pair.Value)) .Select(pair => pair.Key) .ToList(); - using (var groupManager = new GroupManager()) - { + foreach (var g in adminGroups) { - var group = groupManager.FindByNameAsync(g).Result; + var group = _groupManager.FindByNameAsync(g).Result; if (group != null) { if (pManager.GetRightsAsync(group.Id, entityType.Id, notification.Id).Result == 0) pManager.CreateAsync(group.Id, entityType.Id, notification.Id, fullRights); } } - } } //rights to bexcis admin group - using (var groupManager = new GroupManager()) - { - var adminGroup = groupManager.FindByNameAsync("administrator").Result; + + var adminGroup = _groupManager.FindByNameAsync("administrator").Result; if (pManager.GetRightsAsync(adminGroup.Id, entityType.Id, notification.Id).Result == 0) pManager.CreateAsync(adminGroup.Id, entityType.Id, notification.Id, fullRights); - } //rights to user that has create the notification - var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); + var userTask = _userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; pManager.CreateAsync(user, entityType, notification.Id, fullRights); @@ -374,9 +381,9 @@ public ActionResult Edit(long id) public ActionResult Delete(long id) { using (var nManager = new NotificationManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); Notification notification = nManager.GetNotificationById(id); bool deleted = nManager.DeleteNotification(notification); @@ -428,9 +435,9 @@ private bool IsResult(ResourceAttributeValueModel model, long id, List v public ActionResult Notification_Select() { using (var nManager = new NotificationManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); List data = nManager.GetAllNotifications().ToList(); List notifications = new List(); diff --git a/Controllers/ResourceController.cs b/Controllers/ResourceController.cs index 6f902d4..bdf8a86 100644 --- a/Controllers/ResourceController.cs +++ b/Controllers/ResourceController.cs @@ -37,16 +37,22 @@ namespace BExIS.Modules.RBM.UI.Controllers { public class ResourceController : Controller { + private readonly UserManager _userManager; + + public ResourceController(UserManager userManager) + { + _userManager = userManager; + } // GET: /RBM/Resource/ public ActionResult Resource() { ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Resources", this.Session.GetTenant()); List model = new List(); using (var rManager = new ResourceManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) using (var scheduleManager = new ScheduleManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); IQueryable data = rManager.GetAllResources(); long userId = UserHelper.GetUserId(HttpContext.User.Identity.Name); @@ -231,11 +237,10 @@ public ActionResult Save() //Start -> add security ---------------------------------------- - using (var pManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) - using (UserManager userManager = new UserManager()) { - var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); + EntityPermissionManager pManager = new EntityPermissionManager(); + var userTask = _userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; @@ -634,9 +639,9 @@ public ActionResult Delete(long id) { using (var rManager = new ResourceManager()) using (var valueManager = new ResourceStructureAttributeManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); SingleResource resource = rManager.GetResourceById(id); //Delete values before delete resource @@ -1119,7 +1124,6 @@ private Person CreatePerson(List forPersons) private Person UpdatePerson(List forPersons) { - using (UserManager userManager = new UserManager()) using (var pManager = new PersonManager()) { Person newPerson = new Person(); @@ -1136,7 +1140,7 @@ private Person UpdatePerson(List forPersons) List users = new List(); foreach (PersonInConstraint p in forPersons) { - users.Add(userManager.FindByIdAsync(p.UserId).Result); + users.Add(_userManager.FindByIdAsync(p.UserId).Result); } if (person.Self is IndividualPerson) @@ -1167,19 +1171,19 @@ private Person UpdatePerson(List forPersons) { //PersonGroup pG = (PersonGroup)person; //pManager.DeletePersonGroup(pG); - newPerson = pManager.CreateIndividualPerson(userManager.FindByIdAsync(forPersons[0].UserId).Result); + newPerson = pManager.CreateIndividualPerson(_userManager.FindByIdAsync(forPersons[0].UserId).Result); } else if (person.Self is IndividualPerson) { IndividualPerson iPerson = pManager.GetIndividualPersonById(forPersons[0].Id); - iPerson.Person = userManager.FindByIdAsync(forPersons[0].UserId).Result; + iPerson.Person = _userManager.FindByIdAsync(forPersons[0].UserId).Result; newPerson = pManager.UpdateIndividualPerson(iPerson); } } else { - newPerson = pManager.CreateIndividualPerson(userManager.FindByIdAsync(forPersons[0].UserId).Result); + newPerson = pManager.CreateIndividualPerson(_userManager.FindByIdAsync(forPersons[0].UserId).Result); } } @@ -1193,7 +1197,6 @@ public ActionResult LoadUsers(string index) using (var partyManager = new PartyManager()) using (var partyTypeManager = new PartyTypeManager()) - using (UserManager userManager = new UserManager()) { //get party type person @@ -1204,7 +1207,7 @@ public ActionResult LoadUsers(string index) List personListSelected = new List(); List personList = new List(); ResourceConstraintModel tempConstraint = model.ResourceConstraints.Where(a => a.Index == int.Parse(index)).FirstOrDefault(); - var users = userManager.Users; + var users = _userManager.Users; foreach (var user in users) { @@ -1258,10 +1261,9 @@ public ActionResult ChangeSelectedUserConstraint(string userId, string selected, EditResourceModel model = (EditResourceModel)Session["Resource"]; ResourceConstraintModel tempConstraint = model.ResourceConstraints.Where(p=>p.Index == int.Parse(index)).FirstOrDefault(); - using (UserManager userManager = new UserManager()) using (var pManager = new PersonManager()) { - User user = userManager.FindByIdAsync(Convert.ToInt64(userId)).Result; + User user = _userManager.FindByIdAsync(Convert.ToInt64(userId)).Result; if (selected == "true") { diff --git a/Controllers/ResourceStructureController.cs b/Controllers/ResourceStructureController.cs index 21c251c..de5a2dd 100644 --- a/Controllers/ResourceStructureController.cs +++ b/Controllers/ResourceStructureController.cs @@ -24,6 +24,12 @@ namespace BExIS.Modules.RBM.UI.Controllers { public class ResourceStructureController : Controller { + private readonly UserManager _userManager; + + public ResourceStructureController(UserManager userManager) + { + _userManager = userManager; + } #region ResourceStructure public ActionResult ResourceStructure() @@ -32,9 +38,9 @@ public ActionResult ResourceStructure() List model = new List(); using (var rsManager = new ResourceStructureManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); IQueryable data = rsManager.GetAllResourceStructures(); //get id from loged in user @@ -68,10 +74,9 @@ public ActionResult Create() public ActionResult Create(CreateResourceStructureModel model) { using (ResourceStructureManager rsManager = new ResourceStructureManager()) - using (var pManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) - using (UserManager userManager = new UserManager()) { + EntityPermissionManager pManager = new EntityPermissionManager(); //check name ResourceStructure temp = rsManager.GetResourceStructureByName(StringHelper.CutSpaces(model.Name)); if (temp != null) @@ -82,7 +87,7 @@ public ActionResult Create(CreateResourceStructureModel model) ResourceStructure rS = rsManager.Create(model.Name, model.Description, null, null); //Start -> add security ---------------------------------------- - var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); + var userTask = _userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; @@ -208,9 +213,9 @@ public ActionResult RemoveParent(long id) public ActionResult Delete(long id) { using (var rsManager = new ResourceStructureManager()) - using (var permissionManager = new EntityPermissionManager()) using(var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); ResourceStructure resourceStructure = rsManager.GetResourceStructureById(id); bool deleted = rsManager.Delete(resourceStructure); @@ -282,9 +287,9 @@ public ActionResult ResourceStructureAttribute() using (var rsManager = new ResourceStructureManager()) using (var rsaManager = new ResourceStructureAttributeManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); IQueryable rsaList = rsaManager.GetAllResourceStructureAttributes(); foreach (ResourceStructureAttribute a in rsaList) @@ -374,11 +379,10 @@ public ActionResult SaveResourceStructureAttribute(EditResourceStructureAttribut { //Start -> add security ---------------------------------------- - using (EntityPermissionManager pManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) - using (UserManager userManager = new UserManager()) { - var userTask = userManager.FindByNameAsync(HttpContext.User.Identity.Name); + EntityPermissionManager pManager = new EntityPermissionManager(); + var userTask = _userManager.FindByNameAsync(HttpContext.User.Identity.Name); userTask.Wait(); var user = userTask.Result; @@ -482,9 +486,9 @@ private List CreateDomainItems(string[] keys) public ActionResult DeleteResourceStructureAttribute(long id) { using (var rsaManager = new ResourceStructureAttributeManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); ResourceStructureAttribute rsa = rsaManager.GetResourceStructureAttributesById(id); if (rsa != null) { diff --git a/Controllers/ScheduleController.cs b/Controllers/ScheduleController.cs index 6669141..fdcc534 100644 --- a/Controllers/ScheduleController.cs +++ b/Controllers/ScheduleController.cs @@ -38,6 +38,17 @@ namespace BExIS.Modules.RBM.UI.Controllers { public class ScheduleController : Controller { + private readonly UserManager _userManager; + private readonly GroupManager _groupManager; + + public ScheduleController(GroupManager groupManager) + { + _groupManager = groupManager; + } + public ScheduleController(UserManager userManager) + { + _userManager = userManager; + } #region Create Event -- Filter Resources //internal usage to store seleced resources schedules in a session @@ -210,7 +221,6 @@ public ActionResult AddResourceToCart(string id) using (var srManager = new ResourceManager()) using (var pManager = new PersonManager()) - using (UserManager userManager = new UserManager()) { int index = 0; if (model.Count() == 0) @@ -381,7 +391,6 @@ public ActionResult CreateEvent() ViewBag.Title = PresentationModel.GetViewTitleForTenant("Book Resources II", this.Session.GetTenant()); using (var partyManager = new PartyManager()) using (var rManager = new ResourceManager()) - using (UserManager userManager = new UserManager()) { List cart = (List)Session["ResourceCart"]; if (cart == null) @@ -426,7 +435,7 @@ public ActionResult CreateEvent() //add as default resvered by user as reserved for user - var userTask = userManager.FindByIdAsync(rc.ByPersonUserId); + var userTask = _userManager.FindByIdAsync(rc.ByPersonUserId); userTask.Wait(); var user = userTask.Result; @@ -761,13 +770,12 @@ public ActionResult SaveEvent() } } - using (UserManager userManager = new UserManager()) using (var scheduleManager = new ScheduleManager()) using (var personManager = new PersonManager()) using (var eventManager = new BookingEventManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); try { // get event min und max date from schedules @@ -822,15 +830,12 @@ public ActionResult SaveEvent() foreach (var g in adminGroups) { - using (var groupManager = new GroupManager()) - { - var group = groupManager.FindByNameAsync(g).Result; + var group = _groupManager.FindByNameAsync(g).Result; if (group != null) { if (permissionManager.GetRightsAsync(group.Id, entityTypeEvent.Id, eEvent.Id).Result == 0) permissionManager.CreateAsync(group.Id, entityTypeEvent.Id, eEvent.Id, fullRights); } - } } } @@ -849,7 +854,7 @@ public ActionResult SaveEvent() //get user who has created the event/schedule IndividualPerson createdBy = new IndividualPerson(); - User created = userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; + User created = _userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; createdBy = personManager.CreateIndividualPerson(created); Schedule newSchedule = new Schedule(); @@ -872,7 +877,7 @@ public ActionResult SaveEvent() { foreach (PersonInSchedule user in schedule.ForPersons) { - User u = userManager.FindByIdAsync(user.UserId).Result; + User u = _userManager.FindByIdAsync(user.UserId).Result; if (user.IsContactPerson == true) { @@ -887,7 +892,7 @@ public ActionResult SaveEvent() } else { - User u = userManager.FindByIdAsync(schedule.ForPersons[0].UserId).Result; + User u = _userManager.FindByIdAsync(schedule.ForPersons[0].UserId).Result; person = personManager.CreateIndividualPerson(u); } @@ -916,16 +921,13 @@ public ActionResult SaveEvent() //give rights to group if group exsits - using (var groupManager = new GroupManager()) - { - var group = groupManager.FindByNameAsync(adminGroupSchedule).Result; + var group = _groupManager.FindByNameAsync(adminGroupSchedule).Result; if (group != null) { //rights on schedule if (permissionManager.GetRightsAsync(group.Id, entityTypeSchedule.Id, newSchedule.Id).Result == 0) permissionManager.CreateAsync(group.Id, entityTypeSchedule.Id, newSchedule.Id, fullRights); } - } } //add rights to logged in user if not exsit @@ -937,7 +939,7 @@ public ActionResult SaveEvent() //Add rights to the schedule and event for all user reserved for foreach (PersonInSchedule user in schedule.ForPersons) { - User us = userManager.FindByIdAsync(user.UserId).Result; + User us = _userManager.FindByIdAsync(user.UserId).Result; if (us.Id != userIdLoggedIn) { //rights on schedule 15 is the sum from this rights: Read = 1, Download = 2, Write = 4, Delete = 8 @@ -1035,9 +1037,9 @@ private Schedule UpdateSchedule(ScheduleEventModel schedule, IEnumerable a public ActionResult OpenEdit(string id) { - using (var permissionManager = new EntityPermissionManager()) using (var subjectManager = new SubjectManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); BookingEventModel model = (BookingEventModel)Session["Event"]; if (model != null) { @@ -1144,9 +1146,7 @@ public ActionResult ShowUsersInSchedule(string index) }); - using (var userManager = new UserManager()) - { - User user = userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; + User user = _userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; //get event admin groups: format= "groupname:resource structure attribute value" var settings = ModuleManager.GetModuleSettings("rbm"); @@ -1170,8 +1170,6 @@ public ActionResult ShowUsersInSchedule(string index) { tempSchedule.ForPersons.ToList().ForEach(a => a.ShowMobileNr = true); } - } - return PartialView("_scheduleUsers", tempSchedule.ForPersons); @@ -1201,7 +1199,6 @@ public ActionResult LoadUsers(string index) using (var partyManager = new PartyManager()) using (var partyTypeManager = new PartyTypeManager()) - using (UserManager userManager = new UserManager()) { //get party type where you store the first and-lastname of the persons @@ -1272,9 +1269,8 @@ public ActionResult ChangeSelectedUser(string userId, string selected, string in // sEventUser = new List(); using (var partyManager = new PartyManager()) - using (UserManager userManager = new UserManager()) { - var userTask = userManager.FindByIdAsync(Convert.ToInt64(userId)); + var userTask = _userManager.FindByIdAsync(Convert.ToInt64(userId)); userTask.Wait(); var user = userTask.Result; @@ -1374,9 +1370,8 @@ public ActionResult ShowAllUsers(string scheduleIndex) { BookingEventModel sEventM = (BookingEventModel)Session["Event"]; ScheduleEventModel tempSchedule = sEventM.Schedules.Where(a => a.Index == int.Parse(scheduleIndex)).FirstOrDefault(); - using (var userManager = new UserManager()) - { - User user = userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; + + User user = _userManager.FindByNameAsync(HttpContext.User.Identity.Name).Result; //get event admin groups: format= "groupname:resource structure attribute value" var settings = ModuleManager.GetModuleSettings("rbm"); @@ -1400,9 +1395,6 @@ public ActionResult ShowAllUsers(string scheduleIndex) { tempSchedule.ForPersons.ToList().ForEach(a => a.ShowMobileNr = true); } - } - - return PartialView("_showUsers", tempSchedule.ForPersons); } @@ -1838,7 +1830,6 @@ public ActionResult UseSimilarResources(List model) { BookingEventModel sEventM = (BookingEventModel)Session["Event"]; using (ResourceManager srManager = new ResourceManager()) - using (UserManager userManager = new UserManager()) { foreach (AlternateEventResource r in model) { @@ -1848,7 +1839,7 @@ public ActionResult UseSimilarResources(List model) ScheduleEventModel tempSchedule = new ScheduleEventModel(sr); tempSchedule.ScheduleDurationModel.StartDate = r.StartDate; tempSchedule.ScheduleDurationModel.EndDate = r.EndDate; - var userTask = userManager.FindByIdAsync(Convert.ToInt64(r.ContactUserId)); + var userTask = _userManager.FindByIdAsync(Convert.ToInt64(r.ContactUserId)); userTask.Wait(); var user = userTask.Result; var person = new PersonInSchedule(0, user, true); @@ -2087,10 +2078,10 @@ public ActionResult Show(long id) //Session["ScheduleActivities"] = null; Session["Event"] = null; - using (var permissionManager = new EntityPermissionManager()) using (var entityTypeManager = new EntityManager()) using (var eManager = new BookingEventManager()) { + EntityPermissionManager permissionManager = new EntityPermissionManager(); BookingEvent e = eManager.GetBookingEventById(id); BookingEventModel model = new BookingEventModel(e); diff --git a/Helper/RbmSeedDataGenerator.cs b/Helper/RbmSeedDataGenerator.cs index a3f663c..2aa5781 100644 --- a/Helper/RbmSeedDataGenerator.cs +++ b/Helper/RbmSeedDataGenerator.cs @@ -23,6 +23,17 @@ namespace BExIS.Modules.RBM.UI.Helper { public class RbmSeedDataGenerator : IDisposable { + private readonly GroupManager _groupManager; + + public RbmSeedDataGenerator(GroupManager groupManager) + { + _groupManager = groupManager; + } + + public RbmSeedDataGenerator() + { + + } public void Dispose() { //throw new NotImplementedException(); @@ -292,12 +303,11 @@ public void GenerateSeedData() rs_new.Add(new newResourceStructure() { name = "Metal detector (Magna Trak 100) (ALB)", color = "#7e95bf", description = "Metal detector (Magna Trak 100) in Schwäbische Alb", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb" }); //get/create admin group for entity rights - using (var groupManager = new GroupManager()) - using (var permissionManager = new EntityPermissionManager()) using (var entityManager = new EntityManager()) using (var valueManager = new ResourceStructureAttributeManager()) { - var adminGroup = groupManager.Groups.Where(r => r.Name == "administrator").FirstOrDefault(); + EntityPermissionManager permissionManager = new EntityPermissionManager(); + var adminGroup = _groupManager.FindByNameAsync("administrator").Result; if (adminGroup == null) { // create new group @@ -310,7 +320,7 @@ public void GenerateSeedData() IsValid = true }; - groupManager.CreateAsync(adminGroup).Wait(); + _groupManager.CreateAsync(adminGroup).Wait(); } //create right type diff --git a/Helper/SendNotificationHelper.cs b/Helper/SendNotificationHelper.cs index e2259c0..03e6145 100644 --- a/Helper/SendNotificationHelper.cs +++ b/Helper/SendNotificationHelper.cs @@ -10,6 +10,7 @@ using System.Net.Mail; using System.Web; using System.Web.Configuration; +using Vaiona.IoC; using Vaiona.Utils.Cfg; using Vaiona.Web.Mvc.Modularity; @@ -17,6 +18,12 @@ namespace BExIS.Web.Shell.Areas.RBM.Helpers { public class SendNotificationHelper { + private readonly UserManager _userManager; + + public SendNotificationHelper(UserManager userManager) + { + _userManager = userManager; + } public enum BookingAction { created, @@ -60,7 +67,9 @@ public static void SendBookingNotification(BookingAction bookingAction, BookingE if (!String.IsNullOrEmpty(model.Description)) message += "Booking description: " + model.Description + "
"; message += "

Booked Resources:

"; - using (var userManager = new UserManager()) + + var userManager = IoCFactory.Container.Resolve(); + using (var partyManager = new PartyManager()) { foreach (ScheduleEventModel schedule in model.Schedules) @@ -80,7 +89,9 @@ public static void SendBookingNotification(BookingAction bookingAction, BookingE else message += person.UserFullName + ", "; - var user = userManager.FindByIdAsync(person.UserId).Result; + var userTask = userManager.FindByIdAsync(person.UserId); + userTask.Wait(); + var user = userTask.Result; if (user != null) { diff --git a/Helper/UserHelper.cs b/Helper/UserHelper.cs index 37322ff..8e52115 100644 --- a/Helper/UserHelper.cs +++ b/Helper/UserHelper.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; +using Vaiona.IoC; namespace BExIS.Modules.RBM.UI.Helper { @@ -12,18 +13,14 @@ public static class UserHelper { public static long GetUserId(string userName) { - using (UserManager userManager = new UserManager()) - { - return userManager.FindByNameAsync(userName).Result.Id; - } + var userManager = IoCFactory.Container.Resolve(); + return userManager.FindByNameAsync(userName).Result.Id; } public static Security.Entities.Subjects.User GetUser(string userName) { - using (UserManager userManager = new UserManager()) - { - return userManager.FindByNameAsync(userName).Result; - } + var userManager = IoCFactory.Container.Resolve(); + return userManager.FindByNameAsync(userName).Result; } diff --git a/Models/Booking/BookingEventModel.cs b/Models/Booking/BookingEventModel.cs index 3f734a4..b710749 100644 --- a/Models/Booking/BookingEventModel.cs +++ b/Models/Booking/BookingEventModel.cs @@ -1,29 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using R = BExIS.Rbm.Entities.Resource; -using E = BExIS.Rbm.Entities.Booking; +using BExIS.Dlm.Entities.DataStructure; +using BExIS.Dlm.Entities.Party; +using BExIS.Dlm.Services.Party; using BExIS.Rbm.Entities.Booking; -using BExIS.Rbm.Services.Booking; -using BExIS.Web.Shell.Areas.RBM.Models.Resource; -using BExIS.Web.Shell.Areas.RBM.Models.ResourceStructure; +using BExIS.Rbm.Entities.BookingManagementTime; +using BExIS.Rbm.Entities.Resource; using BExIS.Rbm.Entities.ResourceStructure; -using BExIS.Dlm.Entities.DataStructure; +using BExIS.Rbm.Services.Booking; using BExIS.Rbm.Services.Resource; -using BExIS.Rbm.Entities.Resource; using BExIS.Security.Entities.Subjects; using BExIS.Security.Services.Subjects; +using BExIS.Web.Shell.Areas.RBM.Models.Resource; +using BExIS.Web.Shell.Areas.RBM.Models.ResourceStructure; +using Microsoft.AspNet.Identity; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using BExIS.Rbm.Entities.BookingManagementTime; -using BExIS.Dlm.Services.Party; -using BExIS.Dlm.Entities.Party; +using System.Linq; +using System.Web; using Vaiona.Persistence.Api; +using E = BExIS.Rbm.Entities.Booking; +using R = BExIS.Rbm.Entities.Resource; namespace BExIS.Web.Shell.Areas.RBM.Models.Booking { public class BookingEventModel { + private readonly UserManager _userManager; + + public BookingEventModel(UserManager userManager) + { + _userManager = userManager; + } + public DateTime startDate; public DateTime endDate; @@ -58,7 +66,6 @@ public BookingEventModel() public BookingEventModel(List cart) { - using (var userManager = new UserManager()) using (var rManager = new ResourceManager()) { Schedules = new List(); @@ -80,9 +87,7 @@ public BookingEventModel(List cart) //add as default resvered by user as reserved for user - var userTask = userManager.FindByIdAsync(rc.ByPersonUserId); - userTask.Wait(); - var user = userTask.Result; + var user = _userManager.FindByIdAsync(rc.ByPersonUserId).Result; PersonInSchedule byPerson = new PersonInSchedule(0, user, false); byPerson.IsContactPerson = true; From 29bf82115101e374fa1ef4dba8f4b5d21b099de4 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 4 May 2026 15:18:38 +0200 Subject: [PATCH 12/17] fix security manager calls #248 --- Controllers/NotificationController.cs | 7 ++----- Controllers/ScheduleController.cs | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Controllers/NotificationController.cs b/Controllers/NotificationController.cs index d59de19..5bd9f89 100644 --- a/Controllers/NotificationController.cs +++ b/Controllers/NotificationController.cs @@ -29,13 +29,10 @@ public class NotificationController : Controller private readonly GroupManager _groupManager; private readonly UserManager _userManager; - public NotificationController(GroupManager groupManager) - { - _groupManager = groupManager; - } - public NotificationController(UserManager userManager) + public NotificationController(UserManager userManager, GroupManager groupManager) { _userManager = userManager; + _groupManager = groupManager; } #region Notification Management diff --git a/Controllers/ScheduleController.cs b/Controllers/ScheduleController.cs index fdcc534..70351f8 100644 --- a/Controllers/ScheduleController.cs +++ b/Controllers/ScheduleController.cs @@ -41,12 +41,9 @@ public class ScheduleController : Controller private readonly UserManager _userManager; private readonly GroupManager _groupManager; - public ScheduleController(GroupManager groupManager) + public ScheduleController(GroupManager groupManager, UserManager userManager) { _groupManager = groupManager; - } - public ScheduleController(UserManager userManager) - { _userManager = userManager; } #region Create Event -- Filter Resources From 1256f3ab22298e854f097a444a5ab509deb43593 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Tue, 5 May 2026 10:25:05 +0200 Subject: [PATCH 13/17] fix security manager calls #248 --- Models/Booking/BookingEventModel.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Models/Booking/BookingEventModel.cs b/Models/Booking/BookingEventModel.cs index b710749..968803a 100644 --- a/Models/Booking/BookingEventModel.cs +++ b/Models/Booking/BookingEventModel.cs @@ -17,6 +17,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; +using Vaiona.IoC; using Vaiona.Persistence.Api; using E = BExIS.Rbm.Entities.Booking; using R = BExIS.Rbm.Entities.Resource; @@ -27,9 +28,9 @@ public class BookingEventModel { private readonly UserManager _userManager; - public BookingEventModel(UserManager userManager) + public BookingEventModel() { - _userManager = userManager; + _userManager = IoCFactory.Container.Resolve(); } public DateTime startDate; From 3c6f42f18e1ca89d2f908820c54577b1e75f40f2 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Tue, 5 May 2026 10:36:42 +0200 Subject: [PATCH 14/17] fix security manager calls #248 --- Models/Booking/BookingEventModel.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Models/Booking/BookingEventModel.cs b/Models/Booking/BookingEventModel.cs index 968803a..84d5332 100644 --- a/Models/Booking/BookingEventModel.cs +++ b/Models/Booking/BookingEventModel.cs @@ -28,11 +28,6 @@ public class BookingEventModel { private readonly UserManager _userManager; - public BookingEventModel() - { - _userManager = IoCFactory.Container.Resolve(); - } - public DateTime startDate; public DateTime endDate; @@ -63,6 +58,7 @@ public BookingEventModel() { Schedules = new List(); DeletedSchedules = new List(); + _userManager = IoCFactory.Container.Resolve(); } public BookingEventModel(List cart) From 0bb5b8efea121fdb2f9e02d4e44b46d4c6a4e210 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Tue, 5 May 2026 13:38:26 +0200 Subject: [PATCH 15/17] fix security manager calls #248 --- Models/Booking/BookingEventModel.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Models/Booking/BookingEventModel.cs b/Models/Booking/BookingEventModel.cs index 84d5332..e4a830b 100644 --- a/Models/Booking/BookingEventModel.cs +++ b/Models/Booking/BookingEventModel.cs @@ -26,7 +26,6 @@ namespace BExIS.Web.Shell.Areas.RBM.Models.Booking { public class BookingEventModel { - private readonly UserManager _userManager; public DateTime startDate; public DateTime endDate; @@ -58,11 +57,11 @@ public BookingEventModel() { Schedules = new List(); DeletedSchedules = new List(); - _userManager = IoCFactory.Container.Resolve(); } public BookingEventModel(List cart) { + var userManager = IoCFactory.Container.Resolve(); using (var rManager = new ResourceManager()) { Schedules = new List(); @@ -84,7 +83,7 @@ public BookingEventModel(List cart) //add as default resvered by user as reserved for user - var user = _userManager.FindByIdAsync(rc.ByPersonUserId).Result; + var user = userManager.FindByIdAsync(rc.ByPersonUserId).Result; PersonInSchedule byPerson = new PersonInSchedule(0, user, false); byPerson.IsContactPerson = true; From 4213c5e1998424ebdf8a8871248db84378387151 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Wed, 10 Jun 2026 11:35:07 +0200 Subject: [PATCH 16/17] publish profile dev instance https://github.com/bexis/BExIS-intern/issues/804 --- BExIS.Modules.RBM.UI.csproj | 3 +-- ...te.pubxml => BexisServer_BE_DevSite.pubxml} | 2 +- .../BexisServer_v4-ProdTestsite.pubxml | 18 ------------------ 3 files changed, 2 insertions(+), 21 deletions(-) rename Properties/PublishProfiles/{BexisServer_2030-testsite.pubxml => BexisServer_BE_DevSite.pubxml} (91%) delete mode 100644 Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml diff --git a/BExIS.Modules.RBM.UI.csproj b/BExIS.Modules.RBM.UI.csproj index 7428c55..e756b3d 100644 --- a/BExIS.Modules.RBM.UI.csproj +++ b/BExIS.Modules.RBM.UI.csproj @@ -633,8 +633,7 @@ Always - - + PublicSettingsSingleFileGenerator diff --git a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml b/Properties/PublishProfiles/BexisServer_BE_DevSite.pubxml similarity index 91% rename from Properties/PublishProfiles/BexisServer_2030-testsite.pubxml rename to Properties/PublishProfiles/BexisServer_BE_DevSite.pubxml index c2c9d94..16989e4 100644 --- a/Properties/PublishProfiles/BexisServer_2030-testsite.pubxml +++ b/Properties/PublishProfiles/BexisServer_BE_DevSite.pubxml @@ -12,7 +12,7 @@ indem Sie diese MSBuild-Datei bearbeiten. Weitere Informationen hierzu finden Si True False - C:\inetpub\wwwroot\2030-TestSite\Site\Areas\RBM + C:\inetpub\wwwroot\BE_DevSite\Site\Areas\RBM False \ No newline at end of file diff --git a/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml b/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml deleted file mode 100644 index 9eae323..0000000 --- a/Properties/PublishProfiles/BexisServer_v4-ProdTestsite.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - FileSystem - FileSystem - Release - Any CPU - - True - False - C:\inetpub\wwwroot\v4-ProdTestsite\Site\Areas\RBM - False - - \ No newline at end of file From 59e643e8a6d56466fe7a33fd61fdf6e20de29534 Mon Sep 17 00:00:00 2001 From: Eleonora Petzold Date: Mon, 29 Jun 2026 16:22:24 +0200 Subject: [PATCH 17/17] Add missing DataContainerRef #254 --- .../Default/ResourceConstraints/ResourceConstraint.hbm.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BExIS.Rbm.Orm.NH/Mappings/Default/ResourceConstraints/ResourceConstraint.hbm.xml b/BExIS.Rbm.Orm.NH/Mappings/Default/ResourceConstraints/ResourceConstraint.hbm.xml index e47959c..0eb3afe 100644 --- a/BExIS.Rbm.Orm.NH/Mappings/Default/ResourceConstraints/ResourceConstraint.hbm.xml +++ b/BExIS.Rbm.Orm.NH/Mappings/Default/ResourceConstraints/ResourceConstraint.hbm.xml @@ -44,6 +44,12 @@ + +