diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index f355165a..1416d1bb 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -111,12 +111,33 @@ namespace AyaNova.Biz { using (AyContext ct = ServiceProviderProvider.DBContext) { + bool CSR = false; + bool WO = false; + bool WOWIKI = false; + bool UserSettings = false; + bool NotifyServiceImminent = false; + bool NotifyCSRAccepted = false; + bool NotifyCSRRejected = false; + bool NotifyWOCreated = false; + + var UserInfo = await ct.User.AsNoTracking().Where(x => x.Id == userId).Select(x => new { x.UserType, x.HeadOfficeId, x.CustomerId, x.Tags }).FirstAsync(); if (UserInfo.UserType != UserType.Customer && UserInfo.UserType != UserType.HeadOffice) - { - throw new System.NotSupportedException( - $"UserBiz::CustomerUserEffectiveRights - Requested for non Customer type user with ID {userId} who is UserType: {UserInfo.UserType}"); - } + throw new System.NotSupportedException($"UserBiz::CustomerUserEffectiveRights - Requested for non Customer type user with ID {userId} who is UserType: {UserInfo.UserType}"); + + List AllTags = new List(); + AllTags.AddRange(UserInfo.Tags); + if (UserInfo.CustomerId != null && UserInfo.CustomerId != 0) + AllTags.AddRange(await ct.Customer.AsNoTracking().Where(x => x.Id == UserInfo.CustomerId).Select(x => x.Tags).FirstAsync()); + if (UserInfo.HeadOfficeId != null && UserInfo.HeadOfficeId != 0) + AllTags.AddRange(await ct.HeadOffice.AsNoTracking().Where(x => x.Id == UserInfo.HeadOfficeId).Select(x => x.Tags).FirstAsync()); + + + AyaNova.Util.ServerGlobalBizSettings.Cache. + + + + return new CustomerRightsRecord(CSR, WO, WOWIKI, UserSettings, NotifyServiceImminent, NotifyCSRAccepted, NotifyCSRRejected, NotifyWOCreated); } }