v1.2.4.2
This commit is contained in:
@@ -28,7 +28,8 @@ namespace Saxonite.Net.Core.Web.Admin.Consoles
|
||||
public override SaxDataCacheConsole GetDataCacheConsole(SaxSessionContext sessionContext)
|
||||
{
|
||||
String fn = GetType().Name + ".GetDataCacheConsole";
|
||||
throw new NotSupportedException(fn + " Data Cache Console not supported in Admin app.");
|
||||
//throw new NotSupportedException(fn + " Data Cache Console not supported in Admin app.");
|
||||
return null;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -70,14 +70,21 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
// 'Keep logged in' can be switched off by the application configuration.
|
||||
keepLoggedIn = App.AppConfig.Security.SignIn.KeepLoggedIn.Allowed && keepLoggedIn;
|
||||
|
||||
// Log user in.
|
||||
userAccount.KeepLoggedIn_Admin = keepLoggedIn;
|
||||
userAccount.LastLoginAt = DateTime.Now;
|
||||
userAccount.InvalidLoginCount = 0;
|
||||
userAccount.LastInvalidLoginAt = DateTime.MinValue;
|
||||
if (!AccountMgr.UpdateUserAccount(userAccount, DbUpdateInfo))
|
||||
// Log user in - Admin details stored against System Admin role.
|
||||
SaxUserRole userRole = userRoles.Find(item => item.UserRole == Sax.UserRole.SystemAdmin);
|
||||
if (userRole == null)
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update account for " + userAccount.EmailAddress + ": " + AccountMgr.ErrorStateMessage);
|
||||
SaLogger.Warn(fn + " System Admin role not found for " + userAccount.EmailAddress);
|
||||
errorMessage = Localiser["security.msg.signin.invalid"];
|
||||
return false;
|
||||
}
|
||||
userRole.KeepLoggedIn = keepLoggedIn;
|
||||
userRole.LastLoginAt = DateTime.Now;
|
||||
userRole.InvalidLoginCount = 0;
|
||||
userRole.LastInvalidLoginAt = DateTime.MinValue;
|
||||
if (!AccountMgr.UpdateUserRole(userRole, DbUpdateInfo))
|
||||
{
|
||||
SaLogger.Warn(fn + " Failed to update Admin user role for " + userAccount.EmailAddress + ": " + AccountMgr.ErrorStateMessage);
|
||||
errorMessage = Localiser["security.msg.signin.invalid"];
|
||||
return false;
|
||||
}
|
||||
@@ -87,7 +94,7 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
OpenUserSession(SessionContext, userAccount, userRoles);
|
||||
|
||||
// Send the 'Keep Logged In' cookie if requested.
|
||||
if (userAccount.KeepLoggedIn_Admin)
|
||||
if (userRole.KeepLoggedIn)
|
||||
SetKeepLoggedInCookie();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
public String RegionNameProvince { get; set; }
|
||||
public int UserRoleCount { get; set; }
|
||||
public bool? SystemAdmin { get; set; } = null;
|
||||
public String LastLoginAt { get; set; }
|
||||
public String LastOnlineLoginAt { get; set; }
|
||||
public String LastAdminLoginAt { get; set; }
|
||||
}
|
||||
private class UserData_Full : UserData_List
|
||||
{
|
||||
@@ -50,9 +51,13 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
data.RegionNameProvince = model.GetRegionName(user.RegionIdProvince);
|
||||
data.UserRoleCount = userRoles?.GetUserRolesByStatus(SaStatus.Active).Count ?? 0;
|
||||
data.SystemAdmin = (userRoles != null && userRoles.Exists(item => item.UserRole == Sax.UserRole.SystemAdmin) ? true : (bool?)null);
|
||||
data.LastLoginAt = model.FormatDateTimeForDisplay(user.LastLoginAt);
|
||||
data.LastOnlineLoginAt = model.FormatDateTimeForDisplay(user.LastLoginAt);
|
||||
data.StatusCode = user.StatusCode;
|
||||
data.StatusDesc = user.StatusDesc;
|
||||
// System Admin role.
|
||||
SaxUserRole userRole_SystemAdmin = userRoles.Find(item => item.UserRole == Sax.UserRole.SystemAdmin);
|
||||
if (userRole_SystemAdmin != null)
|
||||
data.LastAdminLoginAt = model.FormatDateTimeForDisplay(userRole_SystemAdmin.LastLoginAt);
|
||||
}
|
||||
private void PopulateUserResponseData(SaxModel_Admin model, UserData_Full data, SaxUserAccount user, List<SaxUserRole> userRoles)
|
||||
{
|
||||
@@ -138,13 +143,14 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
ColumnDfn colUserRoleCount = AccountMgr.GetUserAccountColumnDfn(SaxUserAccount.Column.UserRoleCount);
|
||||
ColumnDfn colSystemAdminUser = AccountMgr.GetUserAccountColumnDfn(SaxUserAccount.Column.SystemAdminUser);
|
||||
ColumnDfn colLastLogin = AccountMgr.GetUserAccountColumnDfn(SaxUserAccount.Column.LastLoginAt);
|
||||
ColumnDfn colAdminLastLogin = AccountMgr.GetUserAccountColumnDfn(SaxUserAccount.Column.LastAdminLoginAt);
|
||||
ColumnDfn colStatus = AccountMgr.GetUserAccountColumnDfn(SaxUserAccount.Column.Status);
|
||||
List<ColumnDfn> columns = new List<ColumnDfn>()
|
||||
{
|
||||
colId, colEmail, colTitle, colFirstName, colLastName,
|
||||
colCountryName, colProvinceName,
|
||||
colUserRoleCount, colSystemAdminUser,
|
||||
colLastLogin, colStatus
|
||||
colLastLogin, colAdminLastLogin, colStatus
|
||||
};
|
||||
|
||||
// Query items.
|
||||
@@ -164,7 +170,8 @@ namespace Saxonite.Net.Core.Web.Admin.Controllers
|
||||
RegionNameProvince = values.GetString(colProvinceName.DataName),
|
||||
UserRoleCount = StringUtil.ToInt(values.GetString(colUserRoleCount.DataName)),
|
||||
SystemAdmin = StringUtil.ToBool(values.GetString(colSystemAdminUser.DataName)),
|
||||
LastLoginAt = model.FormatDateTimeForDisplay(values.GetDateTime(colLastLogin.DataName)),
|
||||
LastOnlineLoginAt = model.FormatDateTimeForDisplay(values.GetDateTime(colLastLogin.DataName)),
|
||||
LastAdminLoginAt = model.FormatDateTimeForDisplay(values.GetDateTime(colAdminLastLogin.DataName)),
|
||||
StatusCode = values.GetString(colStatus.DataName),
|
||||
StatusDesc = SacsSystem.GetStatusDescForCode(values.GetString(colStatus.DataName))
|
||||
};
|
||||
|
||||
@@ -134,12 +134,13 @@
|
||||
<div class="sax-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-4"><span class="UserDisplayName"></span></div>
|
||||
<div class="col-sm-4"><div class="UserLastLogin">Last login: <span class="UserLastLoginAt"></span></div></div>
|
||||
<div class="col-sm-4 center"><div class="sax-note UserLastOnlineLogin">Online: <span class="UserLastOnlineLoginAt"></span></div></div>
|
||||
<div class="col-sm-4 right"><span class="UserRegionNameCountry"></span></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4"><div class="UserRoles">Roles: <span class="UserRoleCount"></span></div></div>
|
||||
<div class="col-sm-4"><div class=""></div></div>
|
||||
<div class="col-sm-4 right"><div class="StatusDesc"></div></div>
|
||||
<div class="col-sm-4"><div class="sax-note UserRoles">Roles: <span class="UserRoleCount"></span></div></div>
|
||||
<div class="col-sm-4 center"><div class="sax-note UserLastAdminLogin">Admin: <span class="UserLastAdminLoginAt"></span></div></div>
|
||||
<div class="col-sm-4 right"><div class="sax-note StatusDesc"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -280,8 +280,8 @@
|
||||
|
||||
.sax-panel-item > .sax-content
|
||||
{
|
||||
margin: 4px 8px;
|
||||
padding: 4px 4px;
|
||||
margin: 4px 8px 2px 8px;
|
||||
padding: 2px 2px;
|
||||
}
|
||||
|
||||
.sax-panel-item .sax-note
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
op.showSelectFilterSport = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, items: op.data.sports, fnCallback: op.onFilterSportSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, itemId: $('.FilterOrganisationSportId', $frm.filter).val(), items: op.data.sports, fnCallback: op.onFilterSportSelected });
|
||||
}
|
||||
op.onFilterSportSelected = function (spt)
|
||||
{
|
||||
@@ -144,7 +144,7 @@
|
||||
}
|
||||
op.showSelectOrgSport = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, items: op.data.sports, fnCallback: op.onOrgSportSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, itemId: $('.OrganisationSportId', $frm.org).val(), items: op.data.sports, fnCallback: op.onOrgSportSelected });
|
||||
}
|
||||
op.onOrgSportSelected = function (spt)
|
||||
{
|
||||
@@ -167,7 +167,7 @@
|
||||
}
|
||||
op.showSelectFilterRegion = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, items: op.data.regions, fnCallback: op.onFilterRegionSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, itemId: $('.FilterOrganisationRegionId', $frm.filter).val(), items: op.data.regions, fnCallback: op.onFilterRegionSelected });
|
||||
}
|
||||
op.onFilterRegionSelected = function (rgn)
|
||||
{
|
||||
@@ -203,7 +203,7 @@
|
||||
}
|
||||
op.showSelectOrgRegion = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegion, items: op.data.regions, fnCallback: op.onOrgRegionSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegion, itemId: $('.OrganisationRegionIdCountry', $frm.org).val(), items: op.data.regions, fnCallback: op.onOrgRegionSelected });
|
||||
}
|
||||
op.onOrgRegionSelected = function (rgn)
|
||||
{
|
||||
|
||||
@@ -65,8 +65,10 @@
|
||||
$('.UserRegionNameProvince', $item).text(item.regionNameProvince);
|
||||
$('.UserRoleCount', $item).text(item.userRoleCount);
|
||||
$('.UserRoles', $item).toggle(!!item.userRoleCount);
|
||||
$('.UserLastLoginAt', $item).text(item.lastLoginAt);
|
||||
$('.UserLastLogin', $item).toggle(!!item.lastLoginAt);
|
||||
$('.UserLastOnlineLoginAt', $item).text(item.lastOnlineLoginAt);
|
||||
$('.UserLastOnlineLogin', $item).toggle(!!item.lastOnlineLoginAt);
|
||||
$('.UserLastAdminLoginAt', $item).text(item.lastAdminLoginAt);
|
||||
$('.UserLastAdminLogin', $item).toggle(!!item.lastAdminLoginAt);
|
||||
$('.StatusDesc', $item).text(item.statusDesc).addClass('sax-status-' + item.statusCode.toLowerCase());
|
||||
$('.sax-caption .sax-action').toggleClass('sax-action', !item.deleted);
|
||||
let $mnu = $('ul.sax-dropdown-menu', $item);
|
||||
@@ -129,7 +131,7 @@
|
||||
}
|
||||
sax.showSelectFilterSport = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, items: sax.data.sports, fnCallback: sax.onFilterSportSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectSport, itemId: $('.FilterUserSportId', $frm.filter).val(), items: sax.data.sports, fnCallback: sax.onFilterSportSelected });
|
||||
}
|
||||
sax.onFilterSportSelected = function (spt)
|
||||
{
|
||||
@@ -171,7 +173,7 @@
|
||||
}
|
||||
sax.showSelectFilterRegion = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, items: sax.data.regions, fnCallback: sax.onFilterRegionSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectFilterRegion, itemId: $('.FilterUserRegionId', $frm.filter).val(), items: sax.data.regions, fnCallback: sax.onFilterRegionSelected });
|
||||
}
|
||||
sax.onFilterRegionSelected = function (rgn)
|
||||
{
|
||||
@@ -193,7 +195,7 @@
|
||||
}
|
||||
sax.showSelectRegionCountry = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegionCountry, items: sax.data.regions, fnCallback: sax.onRegionCountrySelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegionCountry, itemId: $('.UserRegionIdCountry', $frm.user).val(), items: sax.data.regions, fnCallback: sax.onRegionCountrySelected });
|
||||
}
|
||||
sax.onRegionCountrySelected = function (rgn)
|
||||
{
|
||||
@@ -215,7 +217,7 @@
|
||||
}
|
||||
sax.showSelectRegionProvince = function ()
|
||||
{
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegionProvince, items: sax.data.regions, fnCallback: sax.onRegionProvinceSelected });
|
||||
sax.data.selectItem.fn.selectItem({ caption: sax.dlg.title.selectRegionProvince, itemId: $('.UserRegionIdProvince', $frm.user).val(), items: sax.data.regions, fnCallback: sax.onRegionProvinceSelected });
|
||||
}
|
||||
sax.onRegionProvinceSelected = function (rgn)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user