ok, tests fixed now?

This commit is contained in:
Shannon
2017-06-29 12:38:33 +10:00
parent abb393c335
commit 4fc5279a78
7 changed files with 22 additions and 11 deletions
@@ -53,7 +53,7 @@ namespace Umbraco.Core.Persistence.Repositories
/// <param name="userGroups">Optional parameter to filter by specified user groups</param>
/// <param name="userState">Optional parameter to filter by specfied user state</param>
/// <returns></returns>
IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object>> orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery<IUser> filter = null);
IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object>> orderBy, Direction orderDirection, string[] userGroups = null, UserState[] userState = null, IQuery<IUser> filter = null);
IProfile GetProfile(string username);
IProfile GetProfile(int id);
@@ -486,7 +486,7 @@ SELECT 'CountOfInvited' AS name, COUNT(id) AS num FROM umbracoUser WHERE lastLog
/// <remarks>
/// The query supplied will ONLY work with data specifically on the umbracoUser table because we are using PetaPoco paging (SQL paging)
/// </remarks>
public IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object>> orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery<IUser> filter = null)
public IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object>> orderBy, Direction orderDirection, string[] userGroups = null, UserState[] userState = null, IQuery<IUser> 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<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, string[] userGroups = null, UserState? userState = null, IQuery<IUser> filter = null)
{
private IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser> query, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection,
string[] userGroups = null,
UserState[] userState = null,
IQuery<IUser> filter = null)
{
//TODO: Implement userState filtering!
if (string.IsNullOrWhiteSpace(orderBy)) throw new ArgumentException("Value cannot be null or whitespace.", "orderBy");
+4 -2
View File
@@ -28,8 +28,10 @@ namespace Umbraco.Core.Services
/// <param name="filter"></param>
/// <returns></returns>
IEnumerable<IUser> 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 = "");
/// <summary>
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method
+1 -1
View File
@@ -498,7 +498,7 @@ namespace Umbraco.Core.Services
}
}
public IEnumerable<IUser> GetAll(long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, UserState? userState = null, string[] userGroups = null, string filter = "")
public IEnumerable<IUser> 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))
{
@@ -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)
{
+4 -3
View File
@@ -184,7 +184,7 @@ namespace Umbraco.Web.Editors
}
/// <summary>
/// Returns all user groups
/// Return a user group
/// </summary>
/// <returns></returns>
public UserGroupDisplay GetUserGroup(int id)
@@ -195,7 +195,7 @@ namespace Umbraco.Web.Editors
return Mapper.Map<UserGroupDisplay>(found);
}
/// <summary>
/// Returns a paged users collection
/// </summary>
@@ -204,6 +204,7 @@ namespace Umbraco.Web.Editors
/// <param name="orderBy"></param>
/// <param name="orderDirection"></param>
/// <param name="userGroups"></param>
/// <param name="userStates"></param>
/// <param name="filter"></param>
/// <returns></returns>
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;
@@ -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<IEnumerable<UserBasic>>(users);
});