diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs index 077456da1b..7e5b5d46cf 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs @@ -5,5 +5,7 @@ namespace Umbraco.Core.Persistence.Repositories internal interface IUserRepository : IRepositoryQueryable { IProfile GetProfileById(int id); + IProfile GetProfileByUserName(string username); + IUser GetUserByUserName(string username); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs index d88a00f187..4de88b7277 100644 --- a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs @@ -147,6 +147,39 @@ namespace Umbraco.Core.Persistence.Repositories return new Profile(dto.Id, dto.UserName); } + public IProfile GetProfileByUserName(string username) + { + var sql = GetBaseQuery(false); + sql.Where(GetBaseWhereClause(), new { Username = username }); + + var dto = Database.FirstOrDefault(sql); + + if (dto == null) + return null; + + return new Profile(dto.Id, dto.UserName); + } + + public IUser GetUserByUserName(string username) + { + var sql = GetBaseQuery(false); + sql.Where(GetBaseWhereClause(), new { Username = username }); + + var dto = Database.FirstOrDefault(sql); + + if (dto == null) + return null; + + return new User(_userTypeRepository.Get(dto.Type)) + { + Id = dto.Id, + Email = dto.Email, + Language = dto.UserLanguage, + Name = dto.UserName + }; + + } + #endregion } } \ No newline at end of file diff --git a/src/Umbraco.Core/Services/IUserService.cs b/src/Umbraco.Core/Services/IUserService.cs index a6b3f8ceef..68a5121382 100644 --- a/src/Umbraco.Core/Services/IUserService.cs +++ b/src/Umbraco.Core/Services/IUserService.cs @@ -15,6 +15,9 @@ namespace Umbraco.Core.Services /// IProfile GetProfileById(int id); + IProfile GetProfileByUserName(string username); + IUser GetUserByUserName(string username); + /// /// Gets an IUserType by its Alias /// diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs index a0b226bfad..ef270e73d9 100644 --- a/src/Umbraco.Core/Services/UserService.cs +++ b/src/Umbraco.Core/Services/UserService.cs @@ -44,6 +44,23 @@ namespace Umbraco.Core.Services } } + public IProfile GetProfileByUserName(string username) + { + using (var repository = _repositoryFactory.CreateUserRepository(_uowProvider.GetUnitOfWork())) + { + return repository.GetProfileByUserName(username); + } + } + + public IUser GetUserByUserName(string username) + { + using (var repository = _repositoryFactory.CreateUserRepository(_uowProvider.GetUnitOfWork())) + { + return repository.GetUserByUserName(username); + } + } + + /// /// Gets an IUserType by its Alias /// diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 958e858c79..9c0dcff245 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -36,7 +36,7 @@ namespace Umbraco.Tests.Models.Mapping var contentType = MockedContentTypes.CreateSimpleContentType(); var content = MockedContent.CreateSimpleContent(contentType); - var mapper = new ContentModelMapper(ApplicationContext, new ProfileModelMapper()); + var mapper = new ContentModelMapper(ApplicationContext, new UserModelMapper()); var result = mapper.ToContentItemDisplay(content); @@ -73,7 +73,7 @@ namespace Umbraco.Tests.Models.Mapping //ensure that nothing is marked as dirty content.ResetDirtyProperties(false); - var mapper = new ContentModelMapper(ApplicationContext, new ProfileModelMapper()); + var mapper = new ContentModelMapper(ApplicationContext, new UserModelMapper()); var result = mapper.ToContentItemDisplay(content); diff --git a/src/Umbraco.Web.UI.Client/build/belle/views/common/application.controller.js b/src/Umbraco.Web.UI.Client/build/belle/views/common/application.controller.js index 697bcbf35b..dfbd7ad1df 100644 --- a/src/Umbraco.Web.UI.Client/build/belle/views/common/application.controller.js +++ b/src/Umbraco.Web.UI.Client/build/belle/views/common/application.controller.js @@ -83,11 +83,14 @@ angular.module('umbraco').controller("MainController", $scope.signin = function () { - $scope.authenticated = userService.authenticate($scope.login, $scope.password); - if($scope.authenticated){ - $scope.user = userService.getCurrentUser(); - } + userService.authenticate($scope.login, $scope.password) + .then(function(data) { + $scope.authenticated = data.authenticated; + $scope.user = data.user; + }, function(reason) { + alert(reason); + }); }; $scope.signout = function () { diff --git a/src/Umbraco.Web.UI.Client/build/belle/views/directives/umb-login.html b/src/Umbraco.Web.UI.Client/build/belle/views/directives/umb-login.html index 240ceaa982..bcc62c879b 100644 --- a/src/Umbraco.Web.UI.Client/build/belle/views/directives/umb-login.html +++ b/src/Umbraco.Web.UI.Client/build/belle/views/directives/umb-login.html @@ -2,8 +2,10 @@

Happy {{today}}!, log in below

-
-
+
+
+
+
-
\ No newline at end of file + diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js new file mode 100644 index 0000000000..292ef1bb55 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js @@ -0,0 +1,33 @@ +/** + * @ngdoc factory + * @name umbraco.resources.authResource + * @description Loads in data for authentication + **/ +function authResource($q, $http, umbDataFormatter, umbRequestHelper) { + + /** internal method to get the api url */ + function getLoginUrl() { + return Umbraco.Sys.ServerVariables.authenticationApiBaseUrl + "PostLogin"; + } + + + return { + performLogin: function (username, password) { + + var deferred = $q.defer(); + //send the data + $http.post(getLoginUrl(), {username: username, password: password}). + success(function (data, status, headers, config) { + deferred.resolve(data); + + }). + error(function (data, status, headers, config) { + deferred.reject('Login failed for user ' + username); + }); + + return deferred.promise; + } + }; +} + +angular.module('umbraco.resources').factory('authResource', authResource); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js index 014d848dce..d784e7cb9a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js @@ -1,29 +1,40 @@ angular.module('umbraco.services') -.factory('userService', function () { +.factory('userService', function (authResource, $q) { - var _currentUser,_authenticated = (jQuery.cookie('authed') === "authenticated"); - var _mockedU = { - name: "Per Ploug", - avatar: "assets/img/avatar.jpeg", - id: 0, - authenticated: true, - locale: 'da-DK' - }; + var _currentUser,_authenticated = (jQuery.cookie('UMB_UCONTEXT') != ""); - if(_authenticated){ - _currentUser = _mockedU; - } + //var _mockedU = { + // name: "Per Ploug", + // avatar: "assets/img/avatar.jpeg", + // id: 0, + // authenticated: true, + // locale: 'da-DK' + //}; + + //if(_authenticated){ + // _currentUser = _mockedU; + //} return { authenticated: _authenticated, currentUser: _currentUser, - authenticate: function(login, password){ - _authenticated = true; - _currentUser = _mockedU; - - jQuery.cookie('authed', "authenticated", {expires: 1}); - return _authenticated; + authenticate: function(login, password) { + + var deferred = $q.defer(); + + authResource.performLogin(login, password) + .then(function (data) { + _currentUser = data; + _authenticated = true; + deferred.resolve({user: data, authenticated: true}); + }, + function (reason) { + deferred.reject(reason); + _authenticated = false; + }); + + return deferred; }, logout: function(){ diff --git a/src/Umbraco.Web.UI.Client/src/views/common/application.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/application.controller.js index 697bcbf35b..dfbd7ad1df 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/application.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/application.controller.js @@ -83,11 +83,14 @@ angular.module('umbraco').controller("MainController", $scope.signin = function () { - $scope.authenticated = userService.authenticate($scope.login, $scope.password); - if($scope.authenticated){ - $scope.user = userService.getCurrentUser(); - } + userService.authenticate($scope.login, $scope.password) + .then(function(data) { + $scope.authenticated = data.authenticated; + $scope.user = data.user; + }, function(reason) { + alert(reason); + }); }; $scope.signout = function () { diff --git a/src/Umbraco.Web.UI.Client/src/views/directives/umb-login.html b/src/Umbraco.Web.UI.Client/src/views/directives/umb-login.html index 240ceaa982..bcc62c879b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/directives/umb-login.html +++ b/src/Umbraco.Web.UI.Client/src/views/directives/umb-login.html @@ -2,8 +2,10 @@

Happy {{today}}!, log in below

-
-
+
+
+
+
-
\ No newline at end of file + diff --git a/src/Umbraco.Web.UI/umbraco/Views/directives/umb-login.html b/src/Umbraco.Web.UI/umbraco/Views/directives/umb-login.html index 240ceaa982..bcc62c879b 100644 --- a/src/Umbraco.Web.UI/umbraco/Views/directives/umb-login.html +++ b/src/Umbraco.Web.UI/umbraco/Views/directives/umb-login.html @@ -2,8 +2,10 @@

Happy {{today}}!, log in below

-
-
+
+
+
+
-
\ No newline at end of file + diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs new file mode 100644 index 0000000000..09fae93e8f --- /dev/null +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -0,0 +1,46 @@ +using System.Net; +using System.Web.Http; +using Umbraco.Web.Models.ContentEditing; +using Umbraco.Web.Models.Mapping; +using Umbraco.Web.Mvc; +using Umbraco.Web.WebApi; + +namespace Umbraco.Web.Editors +{ + /// + /// The API controller used for editing content + /// + [PluginController("UmbracoApi")] + [ValidationFilter] + public class AuthenticationController : UmbracoAuthorizedApiController + { + private readonly UserModelMapper _userModelMapper; + + public AuthenticationController() + : this(new UserModelMapper()) + { + } + + internal AuthenticationController(UserModelMapper userModelMapper) + { + _userModelMapper = userModelMapper; + } + + public UserDetail PostLogin(string username, string password) + { + if (UmbracoContext.Security.ValidateBackOfficeCredentials(username, password)) + { + var user = Services.UserService.GetUserByUserName(username); + //TODO: Clean up the int cast! + UmbracoContext.Security.PerformLogin((int)user.Id); + return _userModelMapper.ToUserDetail(user); + } + throw new HttpResponseException(HttpStatusCode.Unauthorized); + } + + //public HttpResponseMessage PostLogout() + //{ + + //} + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index f9a6ba49b1..2ea7b641b1 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -51,7 +51,8 @@ namespace Umbraco.Web.Editors {"mediaApiBaseUrl", Url.GetUmbracoApiService("GetRootMedia").TrimEnd("GetRootMedia")}, {"treeApplicationApiBaseUrl", Url.GetUmbracoApiService("GetTreeData").TrimEnd("GetTreeData")}, {"contentTypeApiBaseUrl", Url.GetUmbracoApiService("GetAllowedChildren").TrimEnd("GetAllowedChildren")}, - {"mediaTypeApiBaseUrl", Url.GetUmbracoApiService("GetAllowedChildren").TrimEnd("GetAllowedChildren")} + {"mediaTypeApiBaseUrl", Url.GetUmbracoApiService("GetAllowedChildren").TrimEnd("GetAllowedChildren")}, + {"authenticationApiBaseUrl", Url.GetUmbracoApiService("PostLogin").TrimEnd("PostLogin")} }; return JavaScript(ServerVariablesParser.Parse(d)); diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 911bcf2792..6fa7f5c454 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -7,10 +7,12 @@ using System.Web.Http.ModelBinding; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Editors; +using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Models.Mapping; using Umbraco.Web.Mvc; +using Umbraco.Web.Security; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Binders; using Umbraco.Web.WebApi.Filters; @@ -30,7 +32,7 @@ namespace Umbraco.Web.Editors /// Constructor /// public ContentController() - : this(UmbracoContext.Current, new ContentModelMapper(UmbracoContext.Current.Application, new ProfileModelMapper())) + : this(UmbracoContext.Current, new ContentModelMapper(UmbracoContext.Current.Application, new UserModelMapper())) { } diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 512045f90c..d1ea8b5e64 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Editors /// Constructor /// public MediaController() - : this(UmbracoContext.Current, new MediaModelMapper(UmbracoContext.Current.Application, new ProfileModelMapper())) + : this(UmbracoContext.Current, new MediaModelMapper(UmbracoContext.Current.Application, new UserModelMapper())) { } diff --git a/src/Umbraco.Web/Models/ContentEditing/UserDetail.cs b/src/Umbraco.Web/Models/ContentEditing/UserDetail.cs new file mode 100644 index 0000000000..74fe5e641c --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/UserDetail.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; + +namespace Umbraco.Web.Models.ContentEditing +{ + [DataContract(Name = "user", Namespace = "")] + public class UserDetail : UserBasic + { + [DataMember(Name = "email", IsRequired = true)] + [Required] + public string Email { get; set; } + + [DataMember(Name = "locale", IsRequired = true)] + [Required] + public string Language { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Models/Mapping/BaseContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/BaseContentModelMapper.cs index 14512eb02e..add6c5a15b 100644 --- a/src/Umbraco.Web/Models/Mapping/BaseContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/BaseContentModelMapper.cs @@ -12,12 +12,12 @@ namespace Umbraco.Web.Models.Mapping internal class BaseContentModelMapper { protected ApplicationContext ApplicationContext { get; private set; } - protected ProfileModelMapper ProfileMapper { get; private set; } + protected UserModelMapper UserMapper { get; private set; } - public BaseContentModelMapper(ApplicationContext applicationContext, ProfileModelMapper profileMapper) + public BaseContentModelMapper(ApplicationContext applicationContext, UserModelMapper userMapper) { ApplicationContext = applicationContext; - ProfileMapper = profileMapper; + UserMapper = userMapper; } protected ContentItemDto ToContentItemDtoBase(IContentBase content) @@ -86,7 +86,7 @@ namespace Umbraco.Web.Models.Mapping var result = new TContent { Id = content.Id, - Owner = ProfileMapper.ToBasicUser(content.GetCreatorProfile()), + Owner = UserMapper.ToUserBasic(content.GetCreatorProfile()), ParentId = content.ParentId, UpdateDate = content.UpdateDate, diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index e3cb35608e..eb3cda0ed2 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -10,8 +10,8 @@ namespace Umbraco.Web.Models.Mapping internal class ContentModelMapper : BaseContentModelMapper { - public ContentModelMapper(ApplicationContext applicationContext, ProfileModelMapper profileMapper) - : base(applicationContext, profileMapper) + public ContentModelMapper(ApplicationContext applicationContext, UserModelMapper userMapper) + : base(applicationContext, userMapper) { } @@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.Mapping //NOTE: we don't need this for the dto and it's an extra lookup //result.ContentTypeAlias = content.ContentType.Alias; //result.Icon = content.ContentType.Icon; - //result.Updator = ProfileMapper.ToBasicUser(content.GetWriterProfile()); + //result.Updator = userMapper.ToUserBasic(content.GetWriterProfile()); return result; } @@ -30,7 +30,7 @@ namespace Umbraco.Web.Models.Mapping var result = base.ToContentItemSimpleBase(content); result.ContentTypeAlias = content.ContentType.Alias; result.Icon = content.ContentType.Icon; - result.Updator = ProfileMapper.ToBasicUser(content.GetWriterProfile()); + result.Updator = UserMapper.ToUserBasic(content.GetWriterProfile()); return result; } @@ -42,7 +42,7 @@ namespace Umbraco.Web.Models.Mapping var result = CreateContent(content, (display, originalContent) => { //fill in the rest - display.Updator = ProfileMapper.ToBasicUser(content.GetWriterProfile()); + display.Updator = UserMapper.ToUserBasic(content.GetWriterProfile()); display.ContentTypeAlias = content.ContentType.Alias; display.Icon = content.ContentType.Icon; diff --git a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs index a97c249315..7b079664fd 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs @@ -12,8 +12,8 @@ namespace Umbraco.Web.Models.Mapping { internal class MediaModelMapper : BaseContentModelMapper { - public MediaModelMapper(ApplicationContext applicationContext, ProfileModelMapper profileMapper) - : base(applicationContext, profileMapper) + public MediaModelMapper(ApplicationContext applicationContext, UserModelMapper userMapper) + : base(applicationContext, userMapper) { } @@ -23,7 +23,7 @@ namespace Umbraco.Web.Models.Mapping //NOTE: we don't need this for the dto and it's an extra lookup //result.ContentTypeAlias = content.ContentType.Alias; //result.Icon = content.ContentType.Icon; - //result.Updator = ProfileMapper.ToBasicUser(content.GetWriterProfile()); + //result.Updator = userMapper.ToUserBasic(content.GetWriterProfile()); return result; } diff --git a/src/Umbraco.Web/Models/Mapping/ProfileModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ProfileModelMapper.cs deleted file mode 100644 index af4f6a96e0..0000000000 --- a/src/Umbraco.Web/Models/Mapping/ProfileModelMapper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Umbraco.Core; -using Umbraco.Core.Models.Membership; -using Umbraco.Web.Models.ContentEditing; - -namespace Umbraco.Web.Models.Mapping -{ - internal class ProfileModelMapper - { - public UserBasic ToBasicUser(IProfile profile) - { - var user = new UserBasic - { - Name = profile.Name - }; - var result = profile.Id.TryConvertTo(); - if (result.Success == false) - { - throw new InvalidOperationException("Cannot convert the profile to a " + typeof(UserBasic).Name + " object since the id is not an integer"); - } - user.UserId = result.Result; - return user; - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs b/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs new file mode 100644 index 0000000000..f6eee6750c --- /dev/null +++ b/src/Umbraco.Web/Models/Mapping/UserModelMapper.cs @@ -0,0 +1,42 @@ +using System; +using Umbraco.Core; +using Umbraco.Core.Models.Membership; +using Umbraco.Web.Models.ContentEditing; + +namespace Umbraco.Web.Models.Mapping +{ + internal class UserModelMapper + { + public UserDetail ToUserDetail(IUser user) + { + var detail = new UserDetail + { + Name = user.Name, + Email = user.Email, + Language = user.Language + }; + var result = user.Id.TryConvertTo(); + if (result.Success == false) + { + throw new InvalidOperationException("Cannot convert the profile to a " + typeof(UserDetail).Name + " object since the id is not an integer"); + } + detail.UserId = result.Result; + return detail; + } + + public UserBasic ToUserBasic(IProfile profile) + { + var user = new UserBasic + { + Name = profile.Name + }; + var result = profile.Id.TryConvertTo(); + if (result.Success == false) + { + throw new InvalidOperationException("Cannot convert the profile to a " + typeof(UserBasic).Name + " object since the id is not an integer"); + } + user.UserId = result.Result; + return user; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 2e965d2279..6bb0648c49 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -292,6 +292,7 @@ + @@ -301,12 +302,13 @@ + - + diff --git a/src/Umbraco.Web/WebApi/Binders/ContentItemBinder.cs b/src/Umbraco.Web/WebApi/Binders/ContentItemBinder.cs index 9856c42304..d50c1849f1 100644 --- a/src/Umbraco.Web/WebApi/Binders/ContentItemBinder.cs +++ b/src/Umbraco.Web/WebApi/Binders/ContentItemBinder.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.WebApi.Binders /// Constructor /// public ContentItemBinder() - : this(ApplicationContext.Current, new ContentModelMapper(ApplicationContext.Current, new ProfileModelMapper())) + : this(ApplicationContext.Current, new ContentModelMapper(ApplicationContext.Current, new UserModelMapper())) { } diff --git a/src/Umbraco.Web/WebApi/Binders/MediaItemBinder.cs b/src/Umbraco.Web/WebApi/Binders/MediaItemBinder.cs index 2dfd0ae131..02d12ba8b0 100644 --- a/src/Umbraco.Web/WebApi/Binders/MediaItemBinder.cs +++ b/src/Umbraco.Web/WebApi/Binders/MediaItemBinder.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.WebApi.Binders /// Constructor /// public MediaItemBinder() - : this(ApplicationContext.Current, new MediaModelMapper(ApplicationContext.Current, new ProfileModelMapper())) + : this(ApplicationContext.Current, new MediaModelMapper(ApplicationContext.Current, new UserModelMapper())) { }