Added a new docuent_acls app to tie in documents with ACLs
This commit is contained in:
12
apps/document_acls/__init__.py
Normal file
12
apps/document_acls/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from documents.models import Document
|
||||||
|
from navigation.api import register_links, register_multi_item_links
|
||||||
|
from project_setup.api import register_setup
|
||||||
|
|
||||||
|
from acls import ACLS_VIEW_ACL
|
||||||
|
|
||||||
|
|
||||||
|
acl_list = {'text': _(u'ACLs'), 'view': 'document_acl_list', 'args': 'object.pk', 'famfam': 'lock', 'permissions': [ACLS_VIEW_ACL]}
|
||||||
|
|
||||||
|
register_links(Document, [acl_list], menu_name='form_header')
|
||||||
3
apps/document_acls/models.py
Normal file
3
apps/document_acls/models.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
16
apps/document_acls/tests.py
Normal file
16
apps/document_acls/tests.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
This file demonstrates writing tests using the unittest module. These will pass
|
||||||
|
when you run "manage.py test".
|
||||||
|
|
||||||
|
Replace this with more appropriate tests for your application.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
class SimpleTest(TestCase):
|
||||||
|
def test_basic_addition(self):
|
||||||
|
"""
|
||||||
|
Tests that 1 + 1 always equals 2.
|
||||||
|
"""
|
||||||
|
self.assertEqual(1 + 1, 2)
|
||||||
5
apps/document_acls/urls.py
Normal file
5
apps/document_acls/urls.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
|
urlpatterns = patterns('document_acls.views',
|
||||||
|
url(r'^list_for/(?P<document_id>\d+)/$', 'document_acl_list', (), 'document_acl_list'),
|
||||||
|
)
|
||||||
18
apps/document_acls/views.py
Normal file
18
apps/document_acls/views.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from documents.models import Document
|
||||||
|
from acls.views import acl_list_for
|
||||||
|
from acls.models import AccessEntry
|
||||||
|
|
||||||
|
|
||||||
|
def document_acl_list(request, document_id):
|
||||||
|
document = get_object_or_404(Document, pk=document_id)
|
||||||
|
return acl_list_for(
|
||||||
|
request,
|
||||||
|
document,
|
||||||
|
extra_context={
|
||||||
|
'object': document,
|
||||||
|
'object_name': _(u'document'),
|
||||||
|
}
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user