Further work updating security model

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045826
This commit is contained in:
loudej
2010-01-22 05:28:00 +00:00
parent 6d95217b6a
commit c455394cc2
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Roles.Models.NoRecord;
using Orchard.Security;
namespace Orchard.Roles.Models {
public static class UserSimulation {
public static IUser Create(string role) {
var simulation = new ContentItemBuilder("user")
.Weld<SimulatedUser>()
.Weld<SimulatedUserRoles>()
.Build();
simulation.As<SimulatedUserRoles>().Roles = new[] {role};
return simulation.As<IUser>();
}
class SimulatedUser : ContentPart, IUser {
public int Id { get { return ContentItem.Id; } }
public string UserName { get { return null; } }
public string Email { get { return null; } }
}
class SimulatedUserRoles : ContentPart, IUserRoles {
public IList<string> Roles { get; set; }
}
}
}

View File

@@ -0,0 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Orchard.Security {
public class UnauthorizedException : ApplicationException {
}
}