This commit is contained in:
2021-06-15 23:01:24 +00:00
parent 741c2e72e9
commit 5ee1159a5c

View File

@@ -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<string> AllTags = new List<string>();
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);
}
}