This commit is contained in:
@@ -111,12 +111,33 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
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();
|
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)
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user