Skip to content

Commit c8771a0

Browse files
committed
Adding changes to show if the employee have access to web or archive as well as the time planning and ad-hoc tasks.
1 parent 7ecb963 commit c8771a0

File tree

34 files changed

+172
-5
lines changed

34 files changed

+172
-5
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Infrastructure/Models/DeviceUserModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public class DeviceUserModel
9393
public bool IsLocked { get; set; }
9494
public bool IsBackendUser { get; set; }
9595
public bool HasWorkOrdersAssigned { get; set; }
96+
public bool ArchiveEnabled { get; set; }
97+
public bool WebAccessEnabled { get; set; }
9698
public string Manufacturer { get; set; }
9799
public string Model { get; set; }
98100
public string Os { get; set; }

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/Services/BackendConfigurationAssignmentWorkerService/BackendConfigurationAssignmentWorkerService.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2727
using BackendConfiguration.Pn.Services.RebusService;
2828
using Microsoft.AspNetCore.Identity;
2929
using Microsoft.Extensions.Logging;
30+
using Microting.EformAngularFrontendBase.Infrastructure.Data;
3031
using Microting.eFormApi.BasePn.Infrastructure.Database.Entities;
3132
using Microting.EformBackendConfigurationBase.Infrastructure.Enum;
3233
using Microting.eFormCaseTemplateBase.Infrastructure.Data;
@@ -60,6 +61,7 @@ public class BackendConfigurationAssignmentWorkerService(
6061
ItemsPlanningPnDbContext itemsPlanningPnDbContext,
6162
TimePlanningPnDbContext timePlanningDbContext,
6263
CaseTemplatePnDbContext caseTemplatePnDbContext,
64+
BaseDbContext baseDbContext,
6365
IRebusService rebusService,
6466
ILogger<BackendConfigurationAssignmentWorkerService> logger)
6567
: IBackendConfigurationAssignmentWorkerService
@@ -482,7 +484,25 @@ join worker in sdkDbContext.Workers on siteWorker.WorkerId equals worker.Id
482484
.Where(x => x.PlanningSites.Where(y => y.WorkflowState != Constants.WorkflowStates.Removed && y.SiteId == deviceUserModel.SiteId).Select(y => y.SiteId).Any())
483485
.CountAsync().ConfigureAwait(false);
484486

485-
deviceUserModel.IsBackendUser = deviceUserModel.IsLocked;
487+
if (deviceUserModel.WorkerEmail != null && !deviceUserModel.WorkerEmail.Contains("invalid"))
488+
{
489+
var user = await userService.GetByUsernameAsync(deviceUserModel.WorkerEmail!).ConfigureAwait(false);
490+
if (user != null)
491+
{
492+
// deviceUserModel.IsBackendUser = true;
493+
// lookup the security groups based on the user joined with the security group users and security groups
494+
var securityRoles = await (from eformUser in baseDbContext.Users
495+
join securityGroupUser in baseDbContext.SecurityGroupUsers on eformUser.Id equals securityGroupUser.EformUserId
496+
join securityGroup in baseDbContext.SecurityGroups on securityGroupUser.SecurityGroupId equals securityGroup.Id
497+
where eformUser.Id == user.Id && securityGroup.WorkflowState != Constants.WorkflowStates.Removed
498+
select securityGroup.Name).ToListAsync().ConfigureAwait(false);
499+
// deviceUserModel.IsBackendUser = securityRoles.Any(x => x.Contains("eForm users"));
500+
deviceUserModel.IsBackendUser = deviceUserModel.WebAccessEnabled = securityRoles.Any(x => x.Contains("eForm users"));
501+
deviceUserModel.ArchiveEnabled = securityRoles.Any(x => x.Contains("Kun arkiv"));
502+
}
503+
}
504+
505+
// deviceUserModel.IsBackendUser = deviceUserModel.IsLocked;
486506

487507
deviceUserModel.IsLocked = deviceUserModel.IsLocked ? deviceUserModel.IsLocked : numberOfAssignements > 0;
488508

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/bgBG.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@ export const bgBG = {
298298
'Show resigned': 'Покажи оставка',
299299
'Resigned at date': 'Оставка на дата',
300300
'Show expired task on mobile': 'Показване на изтекла задача на мобилно устройство',
301+
Web: 'Уеб',
302+
Archive: 'Архив',
301303
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/csCZ.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@ export const csCZ = {
298298
'Show resigned': 'Zobrazit rezignaci',
299299
'Resigned at date': 'Rezignoval/a k datu',
300300
'Show expired task on mobile': 'Zobrazit vypršelou úlohu na mobilu',
301+
Web: 'Web',
302+
Archive: 'Archiv',
301303
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/da.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,6 @@ export const da = {
300300
'Show resigned': 'Vis fratrådte',
301301
'Resigned at date': 'Fratrådte d.',
302302
'Show expired task on mobile': 'Vis overskredet opgave på mobil',
303+
Web: 'Web',
304+
Archive: 'Arkiv',
303305
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/deDE.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,6 @@ export const deDE = {
359359
'Show resigned': 'Show trat zurück',
360360
'Resigned at date': 'Ausgeschieden am',
361361
'Show expired task on mobile': 'Abgelaufene Aufgaben auf dem Mobilgerät anzeigen',
362+
Web: 'Web',
363+
Archive: 'Archiv',
362364
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/elGR.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@ export const elGR = {
298298
'Show resigned': 'Η εκπομπή παραιτήθηκε',
299299
'Resigned at date': 'Παραιτήθηκε την ημερομηνία',
300300
'Show expired task on mobile': 'Εμφάνιση ληγμένης εργασίας σε κινητό',
301+
Web: 'Ιστός',
302+
Archive: 'Αρχείο',
301303
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/enUS.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,6 @@ export const enUS= {
315315
'Show resigned': 'Show resigned',
316316
'Resigned at date': 'Resigned at date',
317317
'Show expired task on mobile': 'Show expired task on mobile',
318+
'Web': 'Web',
319+
'Archive': 'Archive',
318320
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/esES.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@ export const esES = {
298298
'Show resigned': 'Mostrar resignado',
299299
'Resigned at date': 'Dimitió en la fecha',
300300
'Show expired task on mobile': 'Mostrar tarea expirada en el móvil',
301+
Web: 'Web',
302+
Archive: 'Archivo',
301303
};

eform-client/src/app/plugins/modules/backend-configuration-pn/i18n/etET.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@ export const etET = {
298298
'Show resigned': 'Näita astus tagasi',
299299
'Resigned at date': 'Astus tagasi kuupäeval',
300300
'Show expired task on mobile': 'Kuva aegunud ülesanne mobiilis',
301+
Web: 'Veeb',
302+
Archive: 'Arhiiv',
301303
};

0 commit comments

Comments
 (0)