3.0.1.7 Business object disposability
This commit is contained in:
@@ -135,7 +135,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
/// </summary>
|
||||
public ushort GetCoreSessionIndexForControlRepository(SysId ownerId, SysId repositoryId)
|
||||
{
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
CoreInstanceContextData sessionContext = coreInstances.Values.FirstOrDefault(item => item.ControlRepositoryId.Equals(repositoryId));
|
||||
if (sessionContext != null) return sessionContext.SessionContext.Index;
|
||||
@@ -143,7 +143,6 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
SbmcInstanceMgr instanceMgr = System.CreateControlInstanceMgr();
|
||||
disposables.Add(instanceMgr);
|
||||
SbmcRepository repository = instanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository != null)
|
||||
{
|
||||
// Core database connection.
|
||||
@@ -216,7 +215,7 @@ namespace Sarand.BusinessMgr.Web.Control.App
|
||||
{
|
||||
Development = env.IsDevelopment();
|
||||
environmentName = env.EnvironmentName;
|
||||
SaLogger.LogFilenamePrefix = "Sbm-Web-Adm";
|
||||
SaLogger.LogFilenamePrefix = "Sbm-Web-Ctl";
|
||||
SaLogger.IncludeHostInFileMessage = false;
|
||||
SaLogger.IncludeUserInFileMessage = false;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Sarand.BusinessMgr.Web.Control.Components
|
||||
protected bool SignUserIn(SbmcUserAccount userAccount, bool keepLoggedIn, ref string errorMessage)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
// Validate User Account, just in case - should have been done before arriving here!
|
||||
if (userAccount == null)
|
||||
@@ -160,25 +160,23 @@ namespace Sarand.BusinessMgr.Web.Control.Components
|
||||
string logSuffix = keepLoggedInParams.GetValidParams().Concat("", " ", ".");
|
||||
if (keepLoggedInParams.IsValid())
|
||||
{
|
||||
using (SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(keepLoggedInParams.UserAccountId))
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(keepLoggedInParams.UserAccountId);
|
||||
if (userAccount != null)
|
||||
{
|
||||
if (userAccount != null)
|
||||
if (userAccount.IsStatusActive)
|
||||
{
|
||||
if (userAccount.IsStatusActive)
|
||||
string errorMessage = "";
|
||||
if (SignUserIn(userAccount, true, ref errorMessage))
|
||||
{
|
||||
string errorMessage = "";
|
||||
if (SignUserIn(userAccount, true, ref errorMessage))
|
||||
{
|
||||
// Successful login.
|
||||
SaLogger.Info($"{SysUtil.Fn} Keep Logged In cookie found.{logSuffix}");
|
||||
return true;
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but failed to sign user in: {errorMessage}.{logSuffix}");
|
||||
// Successful login.
|
||||
SaLogger.Info($"{SysUtil.Fn} Keep Logged In cookie found.{logSuffix}");
|
||||
return true;
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but UserAccount is not active.{logSuffix}");
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but failed to sign user in: {errorMessage}.{logSuffix}");
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but UserAccount not found.{logSuffix}");
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but UserAccount is not active.{logSuffix}");
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} Keep Logged In cookie found but UserAccount not found.{logSuffix}");
|
||||
}
|
||||
ClearKeepLoggedInCookie();
|
||||
return false;
|
||||
|
||||
+4
-8
@@ -181,7 +181,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
@@ -191,7 +191,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
|
||||
// Retrieve item.
|
||||
SbmcUserAccount user = ControlAccountMgr.GetUserAccountById(userAccountId);
|
||||
disposables.Add(user);
|
||||
if (user == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + userAccountId + "'");
|
||||
@@ -222,7 +221,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify user.
|
||||
@@ -234,7 +233,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
|
||||
// Retrieve user.
|
||||
SbmcUserAccount user = ControlAccountMgr.GetUserAccountByEmailAddress(model.Filter.EmailAddress);
|
||||
disposables.Add(user);
|
||||
if (user == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Email: " + model.Filter.EmailAddress);
|
||||
@@ -283,12 +281,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmcUserAccount user = ControlAccountMgr.GetUserAccountById(userAccountId);
|
||||
disposables.Add(user);
|
||||
if (user == null && SysId.IsValid(userAccountId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + model.User.Id + "'");
|
||||
@@ -364,13 +361,12 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Account
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve user.
|
||||
SysId userAccountId = SysId.ToSysId(model.User.Id);
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(userAccountId);
|
||||
disposables.Add(userAccount);
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve user for Id: '" + model.User.Id + "'");
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
@@ -175,7 +175,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Retrieve item.
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(ownerId);
|
||||
disposables.Add(owner);
|
||||
if (owner == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + ownerId + "'");
|
||||
@@ -224,12 +223,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(ownerId);
|
||||
disposables.Add(owner);
|
||||
if (owner == null && SysId.IsValid(ownerId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + model.Owner.Id + "'");
|
||||
|
||||
+3
-8
@@ -164,7 +164,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
@@ -174,7 +174,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Retrieve item.
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + repositoryId + "'");
|
||||
@@ -183,7 +182,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Owner.
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(repository.OwnerId);
|
||||
disposables.Add(owner);
|
||||
if (owner == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + repository.OwnerId + "'");
|
||||
@@ -231,7 +229,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
@@ -241,7 +239,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Retrieve item.
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + repositoryId + "'");
|
||||
@@ -309,12 +306,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository == null && SysId.IsValid(repositoryId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve repository for Id: '" + model.Repository.Id + "'");
|
||||
@@ -324,7 +320,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
// Owner.
|
||||
SysId ownerId = repository?.OwnerId ?? SysId.ToSysId(model.Repository.OwnerId);
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(ownerId);
|
||||
disposables.Add(owner);
|
||||
if (owner == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve owner for Id: '" + ownerId + "'");
|
||||
|
||||
+2
-4
@@ -59,7 +59,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Validate Repository.
|
||||
@@ -70,7 +70,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryByContext(model.DatabaseFilter.Context);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Context: {model.DatabaseFilter.Context}.");
|
||||
@@ -165,7 +164,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Validate Repository.
|
||||
@@ -176,7 +175,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryByContext(model.DatabaseFilter.Context);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Context: {model.DatabaseFilter.Context}.");
|
||||
|
||||
+2
-14
@@ -98,7 +98,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Validate Repository.
|
||||
@@ -109,7 +109,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Id: {repositoryId}.");
|
||||
@@ -120,7 +119,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Owner.
|
||||
SbmcOwner owner = ControlInstanceMgr.GetOwnerById(repository.OwnerId);
|
||||
disposables.Add(owner);
|
||||
if (owner == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Owner does not exist. Id: {repository.OwnerId}.");
|
||||
@@ -140,9 +138,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
foreach (SbmAssociation association in instanceConsole.Internals.AccountMgr.GetAssociationList(prm))
|
||||
{
|
||||
// Retrieve Organisation details.
|
||||
disposables.Add(association);
|
||||
SbmAffiliate affiliateOrganisation = instanceConsole.Internals.AccountMgr.GetAffiliateById(association.AffiliateIdOwner);
|
||||
disposables.Add(affiliateOrganisation);
|
||||
|
||||
// Organisation details.
|
||||
RepositoryOrganisationData organisation = new RepositoryOrganisationData()
|
||||
@@ -163,12 +159,9 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
prmAffiliateUser.SortColumns.Add(instanceConsole.Internals.AccountMgr.GetAffiliateColumnDfn(SbmAffiliate.Column.Id));
|
||||
foreach (SbmAffiliate affiliateUser in instanceConsole.Internals.AccountMgr.GetAffiliateList(prmAffiliateUser))
|
||||
{
|
||||
disposables.Add(affiliateUser);
|
||||
|
||||
// Lookup security details.
|
||||
if (!SysId.IsValid(affiliateUser.UserId)) continue;
|
||||
SaSecurityItem securityItemUser = instanceConsole.Internals.SecurityConsole.GetSecurityItemById(SaSecurity.ItemType.User, affiliateUser.UserId);
|
||||
disposables.Add(securityItemUser);
|
||||
if (securityItemUser == null) continue;
|
||||
|
||||
// Confirm security rights (SuperUser).
|
||||
@@ -219,7 +212,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Validate Repository.
|
||||
@@ -230,7 +223,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
return Json(responseData.SetMessage(messageTitle, Localiser["msg.error.system"]));
|
||||
}
|
||||
SbmcRepository repository = ControlInstanceMgr.GetRepositoryById(repositoryId);
|
||||
disposables.Add(repository);
|
||||
if (repository == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Repository does not exist. Id: {repositoryId}.");
|
||||
@@ -254,7 +246,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Validate Organisation Affiliate.
|
||||
SbmAffiliate affiliateOrganisation = instanceConsole.Internals.AccountMgr.GetAffiliateById(affiliateIdOrganisation);
|
||||
disposables.Add(affiliateOrganisation);
|
||||
if (affiliateOrganisation == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Affiliate not found for existing Organisation. Id: {model.Organisation.AffiliateId}.");
|
||||
@@ -278,7 +269,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
{
|
||||
// Validate Internal Association.
|
||||
SbmAssociation associationOrganisation = instanceConsole.Internals.AccountMgr.GetAssociationById(associationIdInternal);
|
||||
disposables.Add(associationOrganisation);
|
||||
if (associationOrganisation == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Association not found for existing Organisation. Id: {model.Organisation.AssociationId}.");
|
||||
@@ -329,7 +319,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
|
||||
// Validate User Affiliate.
|
||||
SbmAffiliate affiliateUser = instanceConsole.Internals.AccountMgr.GetAffiliateById(affiliateIdUser);
|
||||
disposables.Add(affiliateUser);
|
||||
if (affiliateUser == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Affiliate not found for existing User. Id: {model.User.AffiliateId}.");
|
||||
@@ -352,7 +341,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Instance
|
||||
{
|
||||
// Validate User Security Item.
|
||||
SaSecurityItem securityItemUser = instanceConsole.Internals.SecurityConsole.GetSecurityItemById(SaSecurity.ItemType.User, secItemIdUser);
|
||||
disposables.Add(securityItemUser);
|
||||
if (securityItemUser == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Security Item not found for existing User. Id: {model.User.SecurityItemId}.");
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
|
||||
RefreshModel(model);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify item.
|
||||
@@ -287,7 +287,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
|
||||
|
||||
// Retrieve item.
|
||||
SbmcItemParam itemParam = ControlItemMgr.GetItemParamById(itemParamId);
|
||||
disposables.Add(itemParam);
|
||||
if (itemParam == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve itemParam for Id: '" + itemParamId + "'");
|
||||
@@ -336,12 +335,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.Param
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve existing item.
|
||||
SbmcItemParam itemParam = ControlItemMgr.GetItemParamById(itemParamId);
|
||||
disposables.Add(itemParam);
|
||||
if (itemParam == null && SysId.IsValid(itemParamId))
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to retrieve Item Param for Id: '" + model.Param.Id + "'");
|
||||
|
||||
+5
-11
@@ -42,12 +42,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Get user account.
|
||||
SbmcUserAccount userAccount = GetUserAccountForSignin(model, responseData);
|
||||
disposables.Add(userAccount);
|
||||
if (responseData.HasControlErrors())
|
||||
return Json(responseData);
|
||||
|
||||
@@ -100,7 +99,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
SbmcUserAccount userAccount = null;
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Identify user account.
|
||||
@@ -108,7 +107,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
prmUserAccount.EmailAddress = model.EmailAddress;
|
||||
prmUserAccount.StatusCat = SbmcUserAccount.StatusCat.Any;
|
||||
List<SbmcUserAccount> userAccounts = ControlAccountMgr.GetUserAccountList(prmUserAccount);
|
||||
disposables.AddRange(userAccounts);
|
||||
foreach (SbmcUserAccount userAccountCandidate in userAccounts)
|
||||
{
|
||||
// Account must be active to allow sign-in.
|
||||
@@ -165,12 +163,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
return Json(responseData.SetSessionExpired(messageTitle, Localiser["security.msg.warn.sessionExpired"]));
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve user account - in case sign-out needs to be recorded.
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(SessionData_Control.User.UserAccountId);
|
||||
disposables.Add(userAccount);
|
||||
if (userAccount == null)
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} System error on sign-out - failed to retrieve account details. Id: " + SysId.ToInt(SessionData_Control.User.UserAccountId));
|
||||
@@ -230,7 +227,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
String messageTitle = Localiser["caption.change.password"];
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// If 'Request Password' encrypted params (from email link) are present,
|
||||
@@ -243,7 +240,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
{
|
||||
// Retrieve user account details and validate email address.
|
||||
userAccount = ControlAccountMgr.GetUserAccountById(requestPasswordParams.UserAccountId);
|
||||
disposables.Add(userAccount);
|
||||
if (requestPasswordParams.IsValid(userAccount))
|
||||
{
|
||||
validRequestPasswordParams = true;
|
||||
@@ -264,7 +260,6 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
if (userAccount == null && SessionData_Control != null)
|
||||
{
|
||||
userAccount = ControlAccountMgr.GetUserAccountById(SessionData_Control.User.UserAccountId);
|
||||
disposables.Add(userAccount);
|
||||
}
|
||||
if (userAccount == null)
|
||||
return Json(responseData.SetControlError(nameof(model.Password), "System error - failed to retrieve account details."));
|
||||
@@ -336,12 +331,11 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
return Json(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Retrieve user account.
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountByEmailAddress(model.EmailAddress);
|
||||
disposables.Add(userAccount);
|
||||
if (userAccount == null)
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unable to send password request email to " + model.EmailAddress + " - account does not exist");
|
||||
else if (!userAccount.IsStatusActive)
|
||||
|
||||
@@ -68,32 +68,30 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers
|
||||
if (requestPasswordParams.IsValid())
|
||||
{
|
||||
String logSuffix = requestPasswordParams.GetValidParams().Concat("", " ", ".");
|
||||
using (SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(requestPasswordParams.UserAccountId))
|
||||
SbmcUserAccount userAccount = ControlAccountMgr.GetUserAccountById(requestPasswordParams.UserAccountId);
|
||||
if (userAccount != null)
|
||||
{
|
||||
if (userAccount != null)
|
||||
if (userAccount.IsStatusActive)
|
||||
{
|
||||
if (userAccount.IsStatusActive)
|
||||
if (requestPasswordParams.IsValid(userAccount))
|
||||
{
|
||||
if (requestPasswordParams.IsValid(userAccount))
|
||||
{
|
||||
model.rpe = encryptedParams;
|
||||
validSessionRequired = false;
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but invalid. {logSuffix}");
|
||||
model.rpe = encryptedParams;
|
||||
validSessionRequired = false;
|
||||
}
|
||||
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not active. {logSuffix}");
|
||||
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but invalid. {logSuffix}");
|
||||
}
|
||||
else
|
||||
else SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not active. {logSuffix}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// User Account not found - redirect to Portal application.
|
||||
String redirectParamName = ParamName_RequestPasswordEncrypted + "2";
|
||||
SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not 'Admin'. {logSuffix}");
|
||||
if (!Request.Query.Keys.Contains(redirectParamName) && !StringUtil.IsEmpty(AppConfig.URL.Portal.Root))
|
||||
{
|
||||
// User Account not found - redirect to Portal application.
|
||||
String redirectParamName = ParamName_RequestPasswordEncrypted + "2";
|
||||
SaLogger.Warn($"{SysUtil.Fn} 'Request Password' parameters supplied but account is not 'Admin'. {logSuffix}");
|
||||
if (!Request.Query.Keys.Contains(redirectParamName) && !StringUtil.IsEmpty(AppConfig.URL.Portal.Root))
|
||||
{
|
||||
UriBuilder uri = new UriBuilder(Regex.Replace(AppConfig.URL.Portal.Root, "/$", "") + "/Security/ChangePassword");
|
||||
uri.Query = $"{ParamName_RequestPasswordEncrypted}={Uri.EscapeDataString(encryptedParams)}&{redirectParamName}";
|
||||
return Redirect(uri.Uri.OriginalString);
|
||||
}
|
||||
UriBuilder uri = new UriBuilder(Regex.Replace(AppConfig.URL.Portal.Root, "/$", "") + "/Security/ChangePassword");
|
||||
uri.Query = $"{ParamName_RequestPasswordEncrypted}={Uri.EscapeDataString(encryptedParams)}&{redirectParamName}";
|
||||
return Redirect(uri.Uri.OriginalString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposableItems = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposableItems = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
// Database instance.
|
||||
Sbm.Database databaseInstance = EnumUtil.ParseEnum(StringUtil.EmptyOnNull(model.DatabaseFilter.Instance), Sbm.Database.Unknown);
|
||||
@@ -190,7 +190,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposableItems = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposableItems = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Database instance.
|
||||
@@ -438,7 +438,7 @@ namespace Sarand.BusinessMgr.Web.Control.Controllers.System
|
||||
return GetAjaxResult_InvalidSession(responseData);
|
||||
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposableItems = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposableItems = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Parameters.
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Account
|
||||
public bool ValidateUserData(Sacs.Web.Components.SaController.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// User email.
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
public bool ValidateOwnerData(SbmController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Owner name.
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
public bool ValidateRepositoryData(SbmController_Base.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
// Repository Owner.
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Instance
|
||||
public bool ValidateRepositoryData(SbmController_Base.AjaxResponse_Data responseData, SbmcRepository repository)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Sarand.BusinessMgr.Web.Control.Models.Param
|
||||
public bool ValidateParamData(Sacs.Web.Components.SaController.AjaxResponse_Data responseData)
|
||||
{
|
||||
// Record disposable items as they are created so all can be disposed when needed.
|
||||
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
|
||||
using (DisposableCollection<ISacsDisposable> disposables = new DisposableCollection<ISacsDisposable>())
|
||||
{
|
||||
// Check whether data suggests that Param exists.
|
||||
bool paramExists = StringUtil.ToBool(Param.Exists) && SysId.IsValid(SysId.ToSysId(Param.Id));
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
<tr>
|
||||
<th class="width20pc pl-1">@Localiser["label.schema"]</th>
|
||||
<th class="width25pc">@Localiser["label.table"]</th>
|
||||
<th class="width10pc center">@Localiser["label.rows"]</th>
|
||||
<th class="width10pc center">@Localiser["label.columns"]</th>
|
||||
<th class="width10pc center">@Localiser["label.indices"]</th>
|
||||
<th class="width10pc center">@Localiser["label.rows"]</th>
|
||||
<th class="width5pc"></th>
|
||||
<th class="width1pc"></th>
|
||||
</tr>
|
||||
<tr><td colspan="6"><div class="sbc-panel-messages"></div></td></tr>
|
||||
</thead>
|
||||
@@ -83,9 +83,9 @@
|
||||
<tr class="sbc-row-item Table">
|
||||
<td><div class="SchemaName pl-1"></div></td>
|
||||
<td><div class="TableName"></div></td>
|
||||
<td><div class="RowCount center"></div></td>
|
||||
<td><div class="ColumnCount center"></div></td>
|
||||
<td><div class="IndexCount center"></div></td>
|
||||
<td><div class="RowCount center"></div></td>
|
||||
<td>
|
||||
<div class="right">
|
||||
@* Burger menu *@
|
||||
|
||||
@@ -172,9 +172,18 @@ ul.nav.sbc-burger.navbar-dark .dropdown:hover
|
||||
border-color: #c0c0c0;
|
||||
}
|
||||
|
||||
ul.nav.sbc-burger .sbc-ellipsis-dot
|
||||
ul.nav.sbc-burger a .sbc-ellipsis-dot
|
||||
{
|
||||
display: inline-block;
|
||||
width: 2px;
|
||||
height: 2px;
|
||||
margin: 1px 2px 4px 2px;
|
||||
background-color: #808080;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
ul.nav.sbc-burger a:hover .sbc-ellipsis-dot
|
||||
{
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
margin: 0 1px 3px 1px;
|
||||
|
||||
@@ -54,9 +54,13 @@
|
||||
$item.prop('id', cd.getItemId(item));
|
||||
$('.SchemaName', $item).text(item.schemaName);
|
||||
$('.TableName', $item).text(item.tableName);
|
||||
if (item.rowCount) $('.RowCount', $item).text(item.rowCount);
|
||||
if (item.columnCount) $('.ColumnCount', $item).text(item.columnCount);
|
||||
if (item.indexCount) $('.IndexCount', $item).text(item.indexCount);
|
||||
if (item.rowCount) $('.RowCount', $item).text(item.rowCount);
|
||||
// Actions.
|
||||
var $bgr = $('.sbc-burger', $item).hide();
|
||||
let $mnu = $('ul.sbc-dropdown-menu', $bgr).empty();
|
||||
$bgr.toggle(!!$('.sbc-dropdown-item', $mnu).length);
|
||||
return $item;
|
||||
}
|
||||
cd.getItemId = function (item)
|
||||
|
||||
Reference in New Issue
Block a user