Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't heard of any such app… But I don't expect it would be too hard to build.</p> <p>If I were doing it, I would put a permissions check in the entry points to each app. For example:</p> <pre><code>check_app_permission = lambda request: permissions.check_app_permission("blog", request) def view_blog(request, …): check_app_permission(request) … </code></pre> <p>(it might even be possible to do some magic and inject this check at the <code>urls.py</code> level…)</p> <p>Additionally, I would create a <code>has_app_permission</code> template tag:</p> <pre><code>&lt;div id="sidebar"&gt; {% if has_app_permission "blog" %} {% include "blog/sidebar_recent_posts.html" %} {% endif %} &lt;/div&gt; </code></pre> <p>Or similar.</p> <p>Finally, there are approximately a million ways you <em>could</em> implement the permission system… And without more information I wouldn't be able to comment. The simplest, though, would be something like this:</p> <pre><code>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() </code></pre> <p>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.</p> <p>Does that help? Is there something I can clarify?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload