Trying to get my head around engines (I think)

I’ve noticed that there is certain base functionality that I always want
in my Rails apps, and I end up reinventing the wheel for every app I
write. The authentication can be provided by something like Devise
(though i’ll need to see if I can get it set up to do AD auth) but I
also have a User<->Group<->Permissions system to control who can access
pretty much every action, and sometimes sub-elements of an action as
well (for example certain users might be given control over a subset of
objects of a certain type depending on what groups they are in, or might
be able to update some attributes of an object but not others).

The Rails documentation for engines
(Getting Started with Engines — Ruby on Rails Guides) seems to solely focus
on mountable engines. I can see how they’re useful for a /forum section
of a site or similar, but it doesn’t seem like this is what i’d want
with a system that is effectively the core of any app using it. I’m
guessing i’d want a full engine with the User, Group and Permissions
models and controllers in it, but how do I then integrate that with
sites I write? As engines don’t have an application controller where do
I put methods which I want to be accessible from every controller in my
app? I noticed that Devise shows inheriting from it’s controller instead
of AcionController::Base, but i’m not sure how the Devise controller got

Additionally, in some sites i’ll want separate user and admin
namespaces, and all of the functionality for creating and editing
users/groups/permissions and setting memberships etc will be in the
admin side while the user side just has access to the permissions
checking methods and such. In other sites the whole thing is effectively
admin side, it’s a tool for use administering other systems, so there
will be no namespacing. I couldn’t find anything (assuming it is even
possible) about how to generate an engine where I can load the
controllers into a specific namespace if desired. Is it possible, or
would I have to create 2 versions of my engine, one to go in an
unnamespaced app and one where some controllers go into the admin

Does anyone have any links to resources documenting the sort of thing
i’d like to do, or any pointers about where I should start?