Starts the implementation of the new role provider.
This commit is contained in:
@@ -1,59 +1,76 @@
|
||||
using System.Linq;
|
||||
using System.Web.Security;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.Security.Providers
|
||||
{
|
||||
public class MembersRoleProvider : RoleProvider
|
||||
{
|
||||
private readonly IMembershipRoleService<IMember> _roleService;
|
||||
|
||||
public MembersRoleProvider(IMembershipRoleService<IMember> roleService)
|
||||
{
|
||||
_roleService = roleService;
|
||||
}
|
||||
|
||||
public MembersRoleProvider()
|
||||
: this(ApplicationContext.Current.Services.MemberService)
|
||||
{
|
||||
}
|
||||
|
||||
private string _applicationName;
|
||||
|
||||
public override bool IsUserInRole(string username, string roleName)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return GetRolesForUser(username).Any(x => x == roleName);
|
||||
}
|
||||
|
||||
public override string[] GetRolesForUser(string username)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.GetAllRoles(username).ToArray();
|
||||
}
|
||||
|
||||
public override void CreateRole(string roleName)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
_roleService.AddRole(roleName);
|
||||
}
|
||||
|
||||
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.DeleteRole(roleName, throwOnPopulatedRole);
|
||||
}
|
||||
|
||||
public override bool RoleExists(string roleName)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.GetAllRoles().Any(x => x == roleName);
|
||||
}
|
||||
|
||||
public override void AddUsersToRoles(string[] usernames, string[] roleNames)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
_roleService.AssignRoles(usernames, roleNames);
|
||||
}
|
||||
|
||||
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
_roleService.DissociateRoles(usernames, roleNames);
|
||||
}
|
||||
|
||||
public override string[] GetUsersInRole(string roleName)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.GetMembersInRole(roleName).Select(x => x.Username).ToArray();
|
||||
}
|
||||
|
||||
public override string[] GetAllRoles()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.GetAllRoles().ToArray();
|
||||
}
|
||||
|
||||
public override string[] FindUsersInRole(string roleName, string usernameToMatch)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _roleService.FindMembersInRole(roleName, usernameToMatch, StringPropertyMatchType.Wildcard).Select(x => x.Username).ToArray();
|
||||
}
|
||||
|
||||
public override string ApplicationName
|
||||
|
||||
Reference in New Issue
Block a user