Some progress on integration tests

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-09-30 12:13:13 -07:00
parent fa29765490
commit b51229c62f
6 changed files with 168 additions and 161 deletions

View File

@@ -23,7 +23,9 @@ Scenario: I can create a new blog and blog post
| Routable.Title | My Post |
| Body.Text | Hi there. |
And I hit "Publish Now"
And I go to "my-blog"
And I am redirected
Then I should see "Your Blog Post has been created."
When I go to "my-blog"
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
And I should see "<h1[^>]*>.*?My Post.*?</h1>"
When I go to "my-blog/my-post"

View File

@@ -2,7 +2,7 @@
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.5.0.0
// Runtime Version:4.0.30319.1
// Runtime Version:4.0.30319.17011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -113,16 +113,20 @@ this.ScenarioSetup(scenarioInfo);
#line 25
testRunner.And("I hit \"Publish Now\"");
#line 26
testRunner.And("I go to \"my-blog\"");
testRunner.And("I am redirected");
#line 27
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
testRunner.Then("I should see \"Your Blog Post has been created.\"");
#line 28
testRunner.And("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.When("I go to \"my-blog\"");
#line 29
testRunner.When("I go to \"my-blog/my-post\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
#line 30
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.And("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 31
testRunner.When("I go to \"my-blog/my-post\"");
#line 32
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 33
testRunner.And("I should see \"Hi there.\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -135,11 +139,11 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog with multiple blog posts each with the same title and uni" +
"que slugs are generated or given for said posts", ((string[])(null)));
#line 33
this.ScenarioSetup(scenarioInfo);
#line 34
testRunner.Given("I have installed Orchard");
#line 35
this.ScenarioSetup(scenarioInfo);
#line 36
testRunner.Given("I have installed Orchard");
#line 37
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
@@ -148,15 +152,15 @@ this.ScenarioSetup(scenarioInfo);
table3.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 36
#line 38
testRunner.And("I fill in", ((string)(null)), table3);
#line 39
testRunner.And("I hit \"Save\"");
#line 40
testRunner.And("I go to \"admin/blogs\"");
#line 41
testRunner.And("I follow \"My Blog\"");
testRunner.And("I hit \"Save\"");
#line 42
testRunner.And("I go to \"admin/blogs\"");
#line 43
testRunner.And("I follow \"My Blog\"");
#line 44
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
@@ -168,21 +172,21 @@ this.ScenarioSetup(scenarioInfo);
table4.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 43
#line 45
testRunner.And("I fill in", ((string)(null)), table4);
#line 47
testRunner.And("I hit \"Publish Now\"");
#line 48
testRunner.And("I go to \"my-blog/my-post\"");
#line 49
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.And("I hit \"Publish Now\"");
#line 50
testRunner.And("I should see \"Hi there.\"");
testRunner.And("I go to \"my-blog/my-post\"");
#line 51
testRunner.When("I go to \"admin/blogs\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 52
testRunner.And("I follow \"My Blog\"");
testRunner.And("I should see \"Hi there.\"");
#line 53
testRunner.When("I go to \"admin/blogs\"");
#line 54
testRunner.And("I follow \"My Blog\"");
#line 55
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
@@ -194,21 +198,21 @@ this.ScenarioSetup(scenarioInfo);
table5.AddRow(new string[] {
"Body.Text",
"Hi there, again."});
#line 54
#line 56
testRunner.And("I fill in", ((string)(null)), table5);
#line 58
testRunner.And("I hit \"Publish Now\"");
#line 59
testRunner.And("I go to \"my-blog/my-post-2\"");
#line 60
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.And("I hit \"Publish Now\"");
#line 61
testRunner.And("I should see \"Hi there, again.\"");
testRunner.And("I go to \"my-blog/my-post-2\"");
#line 62
testRunner.When("I go to \"admin/blogs\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 63
testRunner.And("I follow \"My Blog\"");
testRunner.And("I should see \"Hi there, again.\"");
#line 64
testRunner.When("I go to \"admin/blogs\"");
#line 65
testRunner.And("I follow \"My Blog\"");
#line 66
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
@@ -223,15 +227,15 @@ this.ScenarioSetup(scenarioInfo);
table6.AddRow(new string[] {
"Body.Text",
"Are you still there?"});
#line 65
#line 67
testRunner.And("I fill in", ((string)(null)), table6);
#line 70
testRunner.And("I hit \"Publish Now\"");
#line 71
testRunner.And("I go to \"my-blog/my-post-3\"");
#line 72
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.And("I hit \"Publish Now\"");
#line 73
testRunner.And("I go to \"my-blog/my-post-3\"");
#line 74
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 75
testRunner.And("I should see \"Are you still there?\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -244,11 +248,11 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog and blog post and when I change the slug of the blog the " +
"path of the plog post is updated", ((string[])(null)));
#line 75
this.ScenarioSetup(scenarioInfo);
#line 76
testRunner.Given("I have installed Orchard");
#line 77
this.ScenarioSetup(scenarioInfo);
#line 78
testRunner.Given("I have installed Orchard");
#line 79
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
@@ -257,19 +261,19 @@ this.ScenarioSetup(scenarioInfo);
table7.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 78
#line 80
testRunner.And("I fill in", ((string)(null)), table7);
#line 81
testRunner.And("I hit \"Save\"");
#line 82
testRunner.And("I go to \"my-blog\"");
#line 83
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
testRunner.And("I hit \"Save\"");
#line 84
testRunner.When("I go to \"admin/blogs\"");
testRunner.And("I go to \"my-blog\"");
#line 85
testRunner.And("I follow \"My Blog\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
#line 86
testRunner.When("I go to \"admin/blogs\"");
#line 87
testRunner.And("I follow \"My Blog\"");
#line 88
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
@@ -281,21 +285,21 @@ this.ScenarioSetup(scenarioInfo);
table8.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 87
#line 89
testRunner.And("I fill in", ((string)(null)), table8);
#line 91
testRunner.And("I hit \"Publish Now\"");
#line 92
testRunner.And("I go to \"my-blog/my-post\"");
#line 93
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.And("I hit \"Publish Now\"");
#line 94
testRunner.And("I should see \"Hi there.\"");
testRunner.And("I go to \"my-blog/my-post\"");
#line 95
testRunner.When("I go to \"admin/blogs\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 96
testRunner.And("I follow \"My Blog\"");
testRunner.And("I should see \"Hi there.\"");
#line 97
testRunner.When("I go to \"admin/blogs\"");
#line 98
testRunner.And("I follow \"My Blog\"");
#line 99
testRunner.And("I follow \"Blog Properties\"");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
@@ -304,19 +308,19 @@ this.ScenarioSetup(scenarioInfo);
table9.AddRow(new string[] {
"Routable.Slug",
"my-other-blog"});
#line 98
#line 100
testRunner.And("I fill in", ((string)(null)), table9);
#line 101
testRunner.And("I hit \"Save\"");
#line 102
testRunner.And("I go to \"my-other-blog\"");
#line 103
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
testRunner.And("I hit \"Save\"");
#line 104
testRunner.When("I go to \"my-other-blog/my-post\"");
testRunner.And("I go to \"my-other-blog\"");
#line 105
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"");
#line 106
testRunner.When("I go to \"my-other-blog/my-post\"");
#line 107
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 108
testRunner.And("I should see \"Hi there.\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -327,11 +331,11 @@ this.ScenarioSetup(scenarioInfo);
public virtual void WhenViewingABlogTheUserAgentIsGivenAnRSSFeedOfTheBlogSPosts()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When viewing a blog the user agent is given an RSS feed of the blog\'s posts", ((string[])(null)));
#line 108
this.ScenarioSetup(scenarioInfo);
#line 109
testRunner.Given("I have installed Orchard");
#line 110
this.ScenarioSetup(scenarioInfo);
#line 111
testRunner.Given("I have installed Orchard");
#line 112
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
@@ -340,15 +344,15 @@ this.ScenarioSetup(scenarioInfo);
table10.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 111
#line 113
testRunner.And("I fill in", ((string)(null)), table10);
#line 114
testRunner.And("I hit \"Save\"");
#line 115
testRunner.And("I go to \"admin/blogs\"");
#line 116
testRunner.And("I follow \"My Blog\"");
testRunner.And("I hit \"Save\"");
#line 117
testRunner.And("I go to \"admin/blogs\"");
#line 118
testRunner.And("I follow \"My Blog\"");
#line 119
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
@@ -360,15 +364,15 @@ this.ScenarioSetup(scenarioInfo);
table11.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 118
#line 120
testRunner.And("I fill in", ((string)(null)), table11);
#line 122
testRunner.And("I hit \"Publish Now\"");
#line 123
testRunner.And("I am redirected");
#line 124
testRunner.And("I go to \"my-blog/my-post\"");
testRunner.And("I hit \"Publish Now\"");
#line 125
testRunner.And("I am redirected");
#line 126
testRunner.And("I go to \"my-blog/my-post\"");
#line 127
testRunner.Then("I should see \"<link rel=\"alternate\" type=\"application/rss\\+xml\" title=\"My Blog\" h" +
"ref=\"/rss\\?containerid=\\d+\" />\"");
#line hidden
@@ -382,15 +386,15 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Enabling remote blog publishing inserts the appropriate metaweblogapi markup into" +
" the blog\'s page", ((string[])(null)));
#line 128
this.ScenarioSetup(scenarioInfo);
#line 129
testRunner.Given("I have installed Orchard");
#line 130
testRunner.And("I have enabled \"XmlRpc\"");
this.ScenarioSetup(scenarioInfo);
#line 131
testRunner.And("I have enabled \"Orchard.Blogs.RemotePublishing\"");
testRunner.Given("I have installed Orchard");
#line 132
testRunner.And("I have enabled \"XmlRpc\"");
#line 133
testRunner.And("I have enabled \"Orchard.Blogs.RemotePublishing\"");
#line 134
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
@@ -399,23 +403,23 @@ this.ScenarioSetup(scenarioInfo);
table12.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 133
#line 135
testRunner.And("I fill in", ((string)(null)), table12);
#line 136
testRunner.And("I hit \"Save\"");
#line 137
testRunner.And("I go to \"my-blog\"");
#line 138
testRunner.And("I hit \"Save\"");
#line 139
testRunner.And("I go to \"my-blog\"");
#line 140
testRunner.Then("I should see \"<link href=\"[^\"]*/XmlRpc/LiveWriter/Manifest\" rel=\"wlwmanifest\" typ" +
"e=\"application/wlwmanifest\\+xml\" />\"");
#line 139
testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\"");
#line 140
testRunner.Then("the content type should be \"\\btext/xml\\b\"");
#line 141
testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\"");
#line 142
testRunner.Then("the content type should be \"\\btext/xml\\b\"");
#line 143
testRunner.And("I should see \"<manifest xmlns=\"http\\://schemas\\.microsoft\\.com/wlw/manifest/weblo" +
"g\">\"");
#line 142
#line 144
testRunner.And("I should see \"<clientType>Metaweblog</clientType>\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -428,13 +432,13 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when not at the root is reflected in the URL " +
"example for the slug field when creating a blog or blog post", ((string[])(null)));
#line 144
this.ScenarioSetup(scenarioInfo);
#line 145
testRunner.Given("I have installed Orchard at \"/OrchardLocal\"");
#line 146
testRunner.When("I go to \"admin/blogs/create\"");
this.ScenarioSetup(scenarioInfo);
#line 147
testRunner.Given("I have installed Orchard at \"/OrchardLocal\"");
#line 148
testRunner.When("I go to \"admin/blogs/create\"");
#line 149
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/</span>\"");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
@@ -443,17 +447,17 @@ this.ScenarioSetup(scenarioInfo);
table13.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 148
#line 150
testRunner.When("I fill in", ((string)(null)), table13);
#line 151
testRunner.And("I hit \"Save\"");
#line 152
testRunner.And("I go to \"admin/blogs\"");
#line 153
testRunner.And("I follow \"My Blog\"");
testRunner.And("I hit \"Save\"");
#line 154
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
testRunner.And("I go to \"admin/blogs\"");
#line 155
testRunner.And("I follow \"My Blog\"");
#line 156
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line 157
testRunner.Then("I should see \"<span>http\\://localhost/OrchardLocal/my-blog/</span>\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -466,13 +470,13 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when at the root is reflected in the URL exam" +
"ple for the slug field when creating a blog or blog post", ((string[])(null)));
#line 157
this.ScenarioSetup(scenarioInfo);
#line 158
testRunner.Given("I have installed Orchard at \"/\"");
#line 159
testRunner.When("I go to \"admin/blogs/create\"");
this.ScenarioSetup(scenarioInfo);
#line 160
testRunner.Given("I have installed Orchard at \"/\"");
#line 161
testRunner.When("I go to \"admin/blogs/create\"");
#line 162
testRunner.Then("I should see \"<span>http\\://localhost/</span>\"");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
@@ -481,17 +485,17 @@ this.ScenarioSetup(scenarioInfo);
table14.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 161
#line 163
testRunner.When("I fill in", ((string)(null)), table14);
#line 164
testRunner.And("I hit \"Save\"");
#line 165
testRunner.And("I go to \"admin/blogs\"");
#line 166
testRunner.And("I follow \"My Blog\"");
testRunner.And("I hit \"Save\"");
#line 167
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
testRunner.And("I go to \"admin/blogs\"");
#line 168
testRunner.And("I follow \"My Blog\"");
#line 169
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line 170
testRunner.Then("I should see \"<span>http\\://localhost/my-blog/</span>\"");
#line hidden
testRunner.CollectScenarioErrors();
@@ -504,11 +508,11 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I set my blog to be the content for the home page and the posts for the blog be r" +
"ooted to the app", ((string[])(null)));
#line 170
this.ScenarioSetup(scenarioInfo);
#line 171
testRunner.Given("I have installed Orchard");
#line 172
this.ScenarioSetup(scenarioInfo);
#line 173
testRunner.Given("I have installed Orchard");
#line 174
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
@@ -520,15 +524,15 @@ this.ScenarioSetup(scenarioInfo);
table15.AddRow(new string[] {
"Routable.PromoteToHomePage",
"true"});
#line 173
#line 175
testRunner.And("I fill in", ((string)(null)), table15);
#line 177
testRunner.And("I hit \"Save\"");
#line 178
testRunner.And("I go to \"admin/blogs\"");
#line 179
testRunner.And("I follow \"My Blog\"");
testRunner.And("I hit \"Save\"");
#line 180
testRunner.And("I go to \"admin/blogs\"");
#line 181
testRunner.And("I follow \"My Blog\"");
#line 182
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
@@ -540,23 +544,23 @@ this.ScenarioSetup(scenarioInfo);
table16.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 181
#line 183
testRunner.And("I fill in", ((string)(null)), table16);
#line 185
testRunner.And("I hit \"Publish Now\"");
#line 186
testRunner.And("I am redirected");
#line 187
testRunner.And("I go to \"/\"");
testRunner.And("I hit \"Publish Now\"");
#line 188
testRunner.Then("I should see \"<h1>My Blog</h1>\"");
testRunner.And("I am redirected");
#line 189
testRunner.When("I go to \"/my-blog\"");
testRunner.And("I go to \"/\"");
#line 190
testRunner.Then("the status should be 404 \"Not Found\"");
testRunner.Then("I should see \"<h1>My Blog</h1>\"");
#line 191
testRunner.When("I go to \"/my-post\"");
testRunner.When("I go to \"/my-blog\"");
#line 192
testRunner.Then("the status should be 404 \"Not Found\"");
#line 193
testRunner.When("I go to \"/my-post\"");
#line 194
testRunner.Then("I should see \"<h1>My Post</h1>\"");
#line hidden
testRunner.CollectScenarioErrors();

View File

@@ -6,27 +6,27 @@
</listeners>
</trace>
<sources>
<source name="Default" switchValue="Warning">
<source name="Default" switchValue="Error">
<listeners>
<add name="CaptureTraceMessages" />
</listeners>
</source>
<source name="Orchard" switchValue="Verbose">
<source name="Orchard" switchValue="Error">
<listeners>
<add name="CaptureTraceMessages" />
</listeners>
</source>
<source name="Orchard.Data.SessionLocator" switchValue="Information">
<source name="Orchard.Data.SessionLocator" switchValue="Error">
<listeners>
<add name="CaptureTraceMessages" />
</listeners>
</source>
<source name="NHibernate.SQL" switchValue="Verbose">
<source name="NHibernate.SQL" switchValue="Error">
<listeners>
<add name="CaptureTraceMessages" />
</listeners>
</source>
<source name="Orchard.Mvc.ViewEngines.WebFormViewEngineProvider" switchValue="Warning">
<source name="Orchard.Mvc.ViewEngines.WebFormViewEngineProvider" switchValue="Error">
<listeners>
<add name="CaptureTraceMessages" />
</listeners>

View File

@@ -87,7 +87,7 @@ namespace Orchard.Blogs.Controllers {
if (!Services.Authorizer.Authorize(Permissions.PublishBlogPost, blog.ContentItem, T("Couldn't publish blog post")))
return new HttpUnauthorizedResult();
Services.ContentManager.Publish(blog.ContentItem);
Services.ContentManager.Publish(blogPost.ContentItem);
}
Services.Notifier.Information(T("Your {0} has been created.", blogPost.TypeDefinition.DisplayName));

View File

@@ -2,6 +2,7 @@ using System.Web.Mvc;
using Orchard.Localization;
using Orchard.Mvc.Filters;
using Orchard.Security;
using Orchard.UI.Admin;
namespace Orchard.Users.Security {
public class FrontEndFilter : FilterProvider, IAuthorizationFilter {
@@ -22,7 +23,7 @@ namespace Orchard.Users.Security {
|| filterContext.ActionDescriptor.ActionName == "Register")
&& filterContext.ActionDescriptor.ControllerDescriptor.ControllerName == "Account";
if (!isAuthPage && !_authorizer.Authorize(StandardPermissions.AccessFrontEnd, T("Can't access this website"))) {
if (!AdminFilter.IsApplied(filterContext.RequestContext) && !isAuthPage && !_authorizer.Authorize(StandardPermissions.AccessFrontEnd, T("Can't access this website"))) {
filterContext.Result = new HttpUnauthorizedResult();
}
}

View File

@@ -21,20 +21,20 @@ namespace Orchard.Mvc.DataAnnotations {
protected override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes) {
var localizedAttributes = new List<Attribute>();
foreach ( var attribute in attributes ) {
// overriden messages have their localization in the scope of the class they are applied to
var tContainer = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, metadata.ContainerType.FullName));
foreach (var attribute in attributes) {
Func<ValidationAttribute, Localizer, ValidationAttribute> localizedAttribute;
// overriden messages have their localization in the scope of the class they are applied to
var tContainer = LocalizationUtilities.Resolve(context, metadata.ContainerType.FullName);
// default translations use the attribute's scope, e.g., Orchard.Mvc.DataAnnotations.LocalizedRequiredAttribute
var tProvider = LocalizationUtilities.Resolve(context, attribute.GetType().FullName);
var tProvider = new Lazy<Localizer>(() => LocalizationUtilities.Resolve(context, attribute.GetType().FullName));
var validationAttribute = attribute as ValidationAttribute;
// substitute the attribute to its localized version if available
if ( _validationAttributes.TryGetValue(attribute.GetType(), out localizedAttribute) ) {
localizedAttributes.Add(localizedAttribute((ValidationAttribute)attribute, tProvider));
localizedAttributes.Add(localizedAttribute((ValidationAttribute)attribute, tProvider.Value));
}
else {
@@ -43,12 +43,12 @@ namespace Orchard.Mvc.DataAnnotations {
var propertyInfo = validationAttribute.GetType().GetProperty("T", typeof(Localizer));
if ( propertyInfo != null ) {
propertyInfo.SetValue(attribute, tProvider, null);
propertyInfo.SetValue(attribute, tProvider.Value, null);
}
}
if ( attribute is DisplayNameAttribute ) {
metadata.DisplayName = tContainer(metadata.DisplayName).Text;
metadata.DisplayName = tContainer.Value(metadata.DisplayName).Text;
}
localizedAttributes.Add(attribute);