diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs
index f6fd38f70f..010f158699 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs
@@ -53,7 +53,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// Optional parameter to filter by specified user groups
/// Optional parameter to filter by specfied user state
///
- IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, Expression> orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery filter = null);
+ IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, Expression> orderBy, Direction orderDirection, string[] userGroups = null, UserState[] userState = null, IQuery filter = null);
IProfile GetProfile(string username);
IProfile GetProfile(int id);
diff --git a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
index 380757fed5..e259eddc6d 100644
--- a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
@@ -486,7 +486,7 @@ SELECT 'CountOfInvited' AS name, COUNT(id) AS num FROM umbracoUser WHERE lastLog
///
/// The query supplied will ONLY work with data specifically on the umbracoUser table because we are using PetaPoco paging (SQL paging)
///
- public IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, Expression> orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery filter = null)
+ public IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, Expression> orderBy, Direction orderDirection, string[] userGroups = null, UserState[] userState = null, IQuery filter = null)
{
if (orderBy == null) throw new ArgumentNullException("orderBy");
@@ -503,8 +503,13 @@ SELECT 'CountOfInvited' AS name, COUNT(id) AS num FROM umbracoUser WHERE lastLog
- private IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery filter = null)
- {
+ private IEnumerable GetPagedResultsByQuery(IQuery query, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection,
+ string[] userGroups = null,
+ UserState[] userState = null,
+ IQuery filter = null)
+ {
+ //TODO: Implement userState filtering!
+
if (string.IsNullOrWhiteSpace(orderBy)) throw new ArgumentException("Value cannot be null or whitespace.", "orderBy");
diff --git a/src/Umbraco.Core/Services/IUserService.cs b/src/Umbraco.Core/Services/IUserService.cs
index 162ee4fb85..3ac485bf2b 100644
--- a/src/Umbraco.Core/Services/IUserService.cs
+++ b/src/Umbraco.Core/Services/IUserService.cs
@@ -28,8 +28,10 @@ namespace Umbraco.Core.Services
///
///
IEnumerable GetAll(long pageIndex, int pageSize, out long totalRecords,
- string orderBy, Direction orderDirection,
- UserState? userState = null, string[] userGroups = null, string filter = "");
+ string orderBy, Direction orderDirection,
+ UserState[] userState = null,
+ string[] userGroups = null,
+ string filter = "");
///
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method
diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs
index e4eed2ce04..ee6bc7b5af 100644
--- a/src/Umbraco.Core/Services/UserService.cs
+++ b/src/Umbraco.Core/Services/UserService.cs
@@ -498,7 +498,7 @@ namespace Umbraco.Core.Services
}
}
- public IEnumerable GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState? userState = null, string[] userGroups = null, string filter = "")
+ public IEnumerable GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState[] userState = null, string[] userGroups = null, string filter = "")
{
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
{
diff --git a/src/Umbraco.Web/Editors/IsCurrentUserModelFilterAttribute.cs b/src/Umbraco.Web/Editors/IsCurrentUserModelFilterAttribute.cs
index 86676b8b4e..d5a0a4022e 100644
--- a/src/Umbraco.Web/Editors/IsCurrentUserModelFilterAttribute.cs
+++ b/src/Umbraco.Web/Editors/IsCurrentUserModelFilterAttribute.cs
@@ -38,7 +38,7 @@ namespace Umbraco.Web.Editors
else
{
var paged = objectContent.Value as UsersController.PagedUserResult;
- if (paged != null)
+ if (paged != null && paged.Items != null)
{
foreach (var userDisplay in paged.Items)
{
diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs
index e4d823bd36..ac0faf96e5 100644
--- a/src/Umbraco.Web/Editors/UsersController.cs
+++ b/src/Umbraco.Web/Editors/UsersController.cs
@@ -184,7 +184,7 @@ namespace Umbraco.Web.Editors
}
///
- /// Returns all user groups
+ /// Return a user group
///
///
public UserGroupDisplay GetUserGroup(int id)
@@ -195,7 +195,7 @@ namespace Umbraco.Web.Editors
return Mapper.Map(found);
}
-
+
///
/// Returns a paged users collection
///
@@ -204,6 +204,7 @@ namespace Umbraco.Web.Editors
///
///
///
+ ///
///
///
public PagedUserResult GetPagedUsers(
@@ -212,7 +213,7 @@ namespace Umbraco.Web.Editors
string orderBy = "username",
Direction orderDirection = Direction.Ascending,
[FromUri]string[] userGroups = null,
- //TODO: Add User state filtering
+ [FromUri]UserState[] userStates = null,
string filter = "")
{
long pageIndex = pageNumber - 1;
diff --git a/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs b/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs
index 4436f79d7f..4a67aa0f26 100644
--- a/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs
@@ -131,6 +131,9 @@ namespace Umbraco.Web.Models.Mapping
.AfterMap((group, display) =>
{
MapUserGroupBasic(applicationContext.Services, group, display);
+
+ //Important! Currently we are never mapping to multiple UserGroupDisplay objects but if we start doing that
+ // this will cause an N+1 and we'll need to change how this works.
var users = applicationContext.Services.UserService.GetAllInGroup(group.Id);
display.Users = Mapper.Map>(users);
});