This commit is contained in:
@@ -351,6 +351,7 @@ namespace AyaNova.Api.Controllers
|
||||
if (u.UserType == UserType.Customer | u.UserType == UserType.HeadOffice)
|
||||
{
|
||||
//customer type has special rights restrictions for UI features so return them here so client UI can enable or disable
|
||||
var effectiveRights = await UserBiz.CustomerUserEffectiveRights(u.Id);
|
||||
return Ok(ApiOkResponse.Response(new
|
||||
{
|
||||
token = token,
|
||||
@@ -359,7 +360,7 @@ namespace AyaNova.Api.Controllers
|
||||
roles = ((int)u.Roles).ToString(),
|
||||
dlt = DownloadToken,
|
||||
tfa = u.TwoFactorEnabled,
|
||||
CustomerRights = UserBiz.CustomerUserEffectiveRights(u.Id)
|
||||
CustomerRights = effectiveRights
|
||||
}));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -111,8 +111,6 @@ namespace AyaNova.Biz
|
||||
{
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
|
||||
|
||||
|
||||
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)
|
||||
@@ -121,12 +119,20 @@ namespace AyaNova.Biz
|
||||
List<string> AllTags = new List<string>();
|
||||
AllTags.AddRange(UserInfo.Tags);
|
||||
|
||||
//Contact is for a customer or for a head office not both so...
|
||||
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)
|
||||
{
|
||||
var CustomerInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == UserInfo.CustomerId).Select(x => new { x.HeadOfficeId, x.Tags }).FirstAsync();
|
||||
AllTags.AddRange(CustomerInfo.Tags);
|
||||
//does the customer have a head office??
|
||||
if (CustomerInfo.HeadOfficeId != null && CustomerInfo.HeadOfficeId != 0)
|
||||
AllTags.AddRange(await ct.HeadOffice.AsNoTracking().Where(x => x.Id == CustomerInfo.HeadOfficeId).Select(x => x.Tags).FirstAsync());
|
||||
}
|
||||
else
|
||||
if (UserInfo.HeadOfficeId != null && UserInfo.HeadOfficeId != 0)
|
||||
AllTags.AddRange(await ct.HeadOffice.AsNoTracking().Where(x => x.Id == UserInfo.HeadOfficeId).Select(x => x.Tags).FirstAsync());
|
||||
|
||||
|
||||
return new CustomerRightsRecord(
|
||||
CustomerUserEffectiveRightsAllowed(AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerAllowCSR,
|
||||
AllTags,
|
||||
|
||||
Reference in New Issue
Block a user