Skip to content
This repository

Error: Security has not been configured for controller #41

Closed
rsacher opened this Issue October 08, 2012 · 2 comments

2 participants

rsacher Kristoffer Ahl
rsacher
Security has not been configured for controller haas2013.Controllers.N2CMS.ContentController, action Index
Area: (not set)
Controller: Content
Action: Index 

although I got:

configuration.ForAllControllersInNamespaceContainingType<haas2013.Controllers.N2CMS.StaticController>().Ignore();

The controller:

namespace haas2013.Controllers.N2CMS
{
    public class StaticController : Controller
    {
        public ActionResult Index()
        {
            ViewData["message"] = "An example of an 'N2-ignorant' controller.";
            ViewData["items"] = new[] {"One", "Two", "Three"};
            return View();
        }

        public ActionResult Items(string id)
        {
            ViewData["message"] = "Showing " + id;
            return View();
        }
    }
}

Other controllers in same namespace: eg:

namespace haas2013.Controllers.N2CMS
{
    [Controls(typeof(AbstractPage))]
    public class ContentController : ContentController<AbstractPage>
    {
    }
}

namespace haas2013.Controllers.N2CMS
{
    [Controls(typeof(NewsPage))]
    public class NewsController : ContentController<NewsPage>
    {
        public override ActionResult Index()
        {
          ............
        }
    }
}

Is this the same problem like #34 ?

haas2013.Controllers.N2CMS.StaticController is not a base class and public... I was under the impression, that once found - all other controllers in that namespace are ignored...??

I want to add N2CMS to my MVC4 project (which itself uses FluentSecurity)

How can I have FluentSec completely ignore anything under namespace haas2013.Controllers.N2CMS ?

Thank you!!
Reinhard

Kristoffer Ahl

Reinhard,
Yes, this is most likely because of the current lack of base class support.
Do you have the same issue when trying to access the overridden Index action of NewsController?

@ridermansb has sent a pull-request that should fix this but I still haven't had time to review and apply it. If all looks good it will be pulled in and part of the next alpha release (2.0). I can't make any promises on when this might be but I'll do my best to speed things up.

You have the option to tell FluentSecurity to ignore missing configurations but in most cases this is not something you want to do. You can read more about this here (see "Ignoring missing configurations"):
http://www.fluentsecurity.net/getting-started

Kristoffer Ahl kristofferahl closed this issue from a commit October 21, 2012
Merge branch 'feature-base-controllers' into develop
Closes #11
Closes #14
Closes #34
Closes #35
Closes #41
a314657
Kristoffer Ahl kristofferahl closed this in a314657 October 21, 2012
Kristoffer Ahl

There's now a fix for this issue. I just uploaded a new alpha version to nuget.

NuGet: https://nuget.org/packages/FluentSecurity/2.0.0-alpha2
Documentation (temporary): https://github.com/kristofferahl/FluentSecurity/wiki/Securing-controllers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.