Merge branch 'U4-11166' of https://github.com/jamescoxhead/Umbraco-CMS into jamescoxhead-U4-11166
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
Active = 0,
|
||||
Disabled = 1,
|
||||
LockedOut = 2,
|
||||
Invited = 3
|
||||
Invited = 3,
|
||||
Inactive = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +186,8 @@ UNION
|
||||
SELECT '4CountOfLockedOut' AS colName, COUNT(id) AS num FROM umbracoUser WHERE userNoConsole = 1
|
||||
UNION
|
||||
SELECT '5CountOfInvited' AS colName, COUNT(id) AS num FROM umbracoUser WHERE lastLoginDate IS NULL AND userDisabled = 1 AND invitedDate IS NOT NULL
|
||||
UNION
|
||||
SELECT '6CountOfDisabled' AS colName, COUNT(id) AS num FROM umbracoUser WHERE userDisabled = 0 AND userNoConsole = 0 AND lastLoginDate IS NULL
|
||||
ORDER BY colName";
|
||||
|
||||
var result = Database.Fetch<dynamic>(sql);
|
||||
@@ -196,7 +198,8 @@ ORDER BY colName";
|
||||
{UserState.Active, (int)result[1].num},
|
||||
{UserState.Disabled, (int)result[2].num},
|
||||
{UserState.LockedOut, (int)result[3].num},
|
||||
{UserState.Invited, (int)result[4].num}
|
||||
{UserState.Invited, (int)result[4].num},
|
||||
{UserState.Inactive, (int) result[5].num}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -765,6 +768,12 @@ ORDER BY colName";
|
||||
sb.Append("(userDisabled = 0 AND userNoConsole = 0 AND lastLoginDate IS NOT NULL)");
|
||||
appended = true;
|
||||
}
|
||||
if (userState.Contains(UserState.Inactive))
|
||||
{
|
||||
if (appended) sb.Append(" OR ");
|
||||
sb.Append("(userDisabled = 0 AND userNoConsole = 0 AND lastLoginDate IS NULL)");
|
||||
appended = true;
|
||||
}
|
||||
if (userState.Contains(UserState.Disabled))
|
||||
{
|
||||
if (appended) sb.Append(" OR ");
|
||||
@@ -915,4 +924,4 @@ ORDER BY colName";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
{ "value": 0, "name": "Active", "key": "Active", "color": "success" },
|
||||
{ "value": 1, "name": "Disabled", "key": "Disabled", "color": "danger" },
|
||||
{ "value": 2, "name": "Locked out", "key": "LockedOut", "color": "danger" },
|
||||
{ "value": 3, "name": "Invited", "key": "Invited", "color": "warning" }
|
||||
{ "value": 3, "name": "Invited", "key": "Invited", "color": "warning" },
|
||||
{ "value": 4, "name": "Inactive", "key": "Inactive", "color": "warning" }
|
||||
];
|
||||
|
||||
angular.forEach(userStates, function (userState) {
|
||||
|
||||
@@ -219,6 +219,7 @@ namespace Umbraco.Web.Editors
|
||||
// so to do that here, we'll need to check if this current user is an admin and if not we should exclude all user who are
|
||||
// also admins
|
||||
|
||||
var hideDisabledUsers = UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice;
|
||||
var excludeUserGroups = new string[0];
|
||||
var isAdmin = Security.CurrentUser.IsAdmin();
|
||||
if (isAdmin == false)
|
||||
@@ -241,10 +242,18 @@ namespace Umbraco.Web.Editors
|
||||
filterQuery.Where(x => x.Name.Contains(filter) || x.Username.Contains(filter));
|
||||
}
|
||||
|
||||
if (hideDisabledUsers)
|
||||
{
|
||||
if (userStates == null || userStates.Any() == false)
|
||||
{
|
||||
userStates = new[] { UserState.Active, UserState.Invited, UserState.LockedOut, UserState.Inactive };
|
||||
}
|
||||
}
|
||||
|
||||
long pageIndex = pageNumber - 1;
|
||||
long total;
|
||||
var result = Services.UserService.GetAll(pageIndex, pageSize, out total, orderBy, orderDirection, userStates, userGroups, excludeUserGroups, filterQuery);
|
||||
|
||||
|
||||
var paged = new PagedUserResult(total, pageNumber, pageSize)
|
||||
{
|
||||
Items = Mapper.Map<IEnumerable<UserBasic>>(result),
|
||||
|
||||
Reference in New Issue
Block a user