This commit is contained in:
2020-01-28 18:52:21 +00:00
parent a94260b300
commit a653ff4963
3 changed files with 14 additions and 17 deletions

View File

@@ -24,17 +24,15 @@ namespace AyaNova.Biz
BizType = AyaType.FormCustom;
}
internal static FormCustomBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
internal static FormCustomBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
{
return new FormCustomBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
if (httpContext != null)
return new FormCustomBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
else//when called internally for internal ops there will be no context so need to set default values for that
return new FormCustomBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
}
// //Version for internal use
// internal static FormCustomBiz GetBizInternal(AyContext ct)
// {
// return new FormCustomBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
// }
////////////////////////////////////////////////////////////////////////////////////////////////
//EXISTS

View File

@@ -38,16 +38,15 @@ namespace AyaNova.Biz
return ret;
}
internal static UserBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
internal static UserBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
{
return new UserBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
if (httpContext != null)
return new UserBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
else//when called internally for internal ops there will be no context so need to set default values for that
return new UserBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
}
// //Version for internal use
// internal static UserBiz GetBizInternal(AyContext ct)
// {
// return new UserBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
// }
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE

View File

@@ -132,7 +132,7 @@ namespace AyaNova.Util
//Create and save to db
using (var cct = ServiceProviderProvider.DBContext)
{
await FormCustomBiz.GetBizInternal(cct).CreateAsync(fc);
await FormCustomBiz.GetBiz(cct).CreateAsync(fc);
}
}
@@ -516,7 +516,7 @@ namespace AyaNova.Util
using (var ct = ServiceProviderProvider.DBContext)
{
UserBiz Biz = UserBiz.GetBizInternal(ct);
UserBiz Biz = UserBiz.GetBiz(ct);
//allow creation of not entirely ready users (missing client id or subcontractor vendor id etc)
Biz.SeedOrImportRelaxedRulesMode = true;