Q:

Django app to "switch on" other apps for specyfic user

I am new to django and I really like its modular construction so I decided to take advantage of it and put all the separated functionalities each in different app. 
Now I need a way to switch on and off this apps by both user and admin. 
The user options panel would look like this:

   [ ] blog
   ---------------------
   [ ] tagging  [BUY]

After checking "blog" option user would get the blog in his profile and after buying and checking "tagging" he would get tagging for the blog. 

The admin panel would have an ability to show or hide an app from user panel. 
I wonder if:

there is an app which would help me switch on and off an app for specyfic user 
and if not - 

what would be a proper "architecture" for such django app?  
Can it be done dynamically in middleware  or should it be done during login (check available apps from database, switch them on, redirect to user home page)?  
Any advices for such a task? 

Thanks,
Robert

A:

I haven't heard of any such app… But I don't expect it would be too hard to build. 
If I were doing it, I would put a permissions check in the entry points to each app.  For example:
check_app_permission = lambda request: permissions.check_app_permission("blog", request)

def view_blog(request, …):
    check_app_permission(request)
    …

(it might even be possible to do some magic and inject this check at the urls.py level…)
Additionally, I would create a has_app_permission template tag:
<div id="sidebar">
    {% if has_app_permission "blog" %}
        {% include "blog/sidebar_recent_posts.html" %}
    {% endif %}
</div>

Or similar. 
Finally, there are approximately a million ways you could implement the permission system… And without more information I wouldn't be able to comment.  The simplest, though, would be something like this:
class App(Model):
    name = CharField(…)

class AppPermission(object):
    app = ForeignKey(App)
    user = ForiegnKey(User)

def user_has_permission(user, app_name):
    return AppPermission.objects.filter(app__name=app_name, user=user).exists()

I would avoid trying to do this with middleware, because if I understand the problem correctly, I expect you will (or, at least, I expect I would) end up spending a bunch of time building a generic framework which, in the end, would just have checks similar to those above. 
Does that help?  Is there something I can clarify?