Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarincev committed May 26, 2017
2 parents 37ae31b + f025698 commit ed9a249
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions VirtoCommerce.Platform.Data.Security/SecurityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ public SecurityService(Func<IPlatformRepository> platformRepository, Func<Applic
}

#region ISecurityService Members
public async Task<ApplicationUserExtended> FindByNameAsync(string userName, UserDetails detailsLevel)
public virtual async Task<ApplicationUserExtended> FindByNameAsync(string userName, UserDetails detailsLevel)
{
var user = await GetApplicationUserByNameAsync(userName);
return GetUserExtended(user, detailsLevel);
}

public async Task<ApplicationUserExtended> FindByIdAsync(string userId, UserDetails detailsLevel)
public virtual async Task<ApplicationUserExtended> FindByIdAsync(string userId, UserDetails detailsLevel)
{
var user = await GetApplicationUserByIdAsync(userId);
return GetUserExtended(user, detailsLevel);
}

public async Task<ApplicationUserExtended> FindByEmailAsync(string email, UserDetails detailsLevel)
public virtual async Task<ApplicationUserExtended> FindByEmailAsync(string email, UserDetails detailsLevel)
{
using (var userManager = _userManagerFactory())
{
Expand All @@ -59,7 +59,7 @@ public async Task<ApplicationUserExtended> FindByEmailAsync(string email, UserDe
}
}

public async Task<ApplicationUserExtended> FindByLoginAsync(string loginProvider, string providerKey, UserDetails detailsLevel)
public virtual async Task<ApplicationUserExtended> FindByLoginAsync(string loginProvider, string providerKey, UserDetails detailsLevel)
{
using (var userManager = _userManagerFactory())
{
Expand All @@ -68,7 +68,7 @@ public async Task<ApplicationUserExtended> FindByLoginAsync(string loginProvider
}
}

public async Task<SecurityResult> CreateAsync(ApplicationUserExtended user)
public virtual async Task<SecurityResult> CreateAsync(ApplicationUserExtended user)
{
IdentityResult result;

Expand Down Expand Up @@ -115,7 +115,7 @@ public async Task<SecurityResult> CreateAsync(ApplicationUserExtended user)
return result.ToCoreModel();
}

public async Task<SecurityResult> UpdateAsync(ApplicationUserExtended user)
public virtual async Task<SecurityResult> UpdateAsync(ApplicationUserExtended user)
{
SecurityResult result;

Expand Down Expand Up @@ -174,7 +174,7 @@ public async Task<SecurityResult> UpdateAsync(ApplicationUserExtended user)
return result;
}

public async Task DeleteAsync(string[] names)
public virtual async Task DeleteAsync(string[] names)
{
using (var userManager = _userManagerFactory())
{
Expand Down Expand Up @@ -204,14 +204,14 @@ public async Task DeleteAsync(string[] names)
}
}

public ApiAccount GenerateNewApiAccount(ApiAccountType type)
public virtual ApiAccount GenerateNewApiAccount(ApiAccountType type)
{
var apiAccount = _apiAccountProvider.GenerateApiCredentials(type);
var result = apiAccount.ToCoreModel();
return result;
}

public async Task<SecurityResult> ChangePasswordAsync(string name, string oldPassword, string newPassword)
public virtual async Task<SecurityResult> ChangePasswordAsync(string name, string oldPassword, string newPassword)
{
using (var userManager = _userManagerFactory())
{
Expand All @@ -228,7 +228,7 @@ public async Task<SecurityResult> ChangePasswordAsync(string name, string oldPas
}
}

public async Task<SecurityResult> ResetPasswordAsync(string name, string newPassword)
public virtual async Task<SecurityResult> ResetPasswordAsync(string name, string newPassword)
{
using (var userManager = _userManagerFactory())
{
Expand All @@ -246,7 +246,7 @@ public async Task<SecurityResult> ResetPasswordAsync(string name, string newPass
}
}

public async Task<SecurityResult> ResetPasswordAsync(string userId, string token, string newPassword)
public virtual async Task<SecurityResult> ResetPasswordAsync(string userId, string token, string newPassword)
{
using (var userManager = _userManagerFactory())
{
Expand All @@ -263,7 +263,7 @@ public async Task<SecurityResult> ResetPasswordAsync(string userId, string token
}
}

public async Task<UserSearchResponse> SearchUsersAsync(UserSearchRequest request)
public virtual async Task<UserSearchResponse> SearchUsersAsync(UserSearchRequest request)
{
request = request ?? new UserSearchRequest();
var result = new UserSearchResponse();
Expand Down Expand Up @@ -311,20 +311,20 @@ public async Task<UserSearchResponse> SearchUsersAsync(UserSearchRequest request
}
}

public async Task<string> GeneratePasswordResetTokenAsync(string userId)
public virtual async Task<string> GeneratePasswordResetTokenAsync(string userId)
{
using (var userManager = _userManagerFactory())
{
return await userManager.GeneratePasswordResetTokenAsync(userId);
}
}

public Permission[] GetAllPermissions()
public virtual Permission[] GetAllPermissions()
{
return _cacheManager.Get("AllPermissions", "PlatformRegion", LoadAllPermissions);
}

public bool UserHasAnyPermission(string userName, string[] scopes, params string[] permissionIds)
public virtual bool UserHasAnyPermission(string userName, string[] scopes, params string[] permissionIds)
{
if (permissionIds == null)
{
Expand Down Expand Up @@ -358,7 +358,7 @@ public bool UserHasAnyPermission(string userName, string[] scopes, params string
return result;
}

public Permission[] GetUserPermissions(string userName)
public virtual Permission[] GetUserPermissions(string userName)
{
var user = FindByName(userName, UserDetails.Full);
var result = user != null ? user.Roles.SelectMany(x => x.Permissions).Distinct().ToArray() : Enumerable.Empty<Permission>().ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package>
<metadata>
<id>$id$</id>
<version>2.13.0</version>
<version>2.13.7-rc1</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
Expand Down

0 comments on commit ed9a249

Please sign in to comment.