diff options
-rw-r--r-- | coip/apps/name/views.py | 4 | ||||
-rw-r--r-- | coip/extensions/templatetags/permdisplay.py | 28 | ||||
-rw-r--r-- | coip/multiresponse.py | 2 | ||||
-rw-r--r-- | templates/apps/name/acls.html | 2 | ||||
-rw-r--r-- | templates/base.html | 8 |
5 files changed, 31 insertions, 13 deletions
diff --git a/coip/apps/name/views.py b/coip/apps/name/views.py index aacc67e..dba73c2 100644 --- a/coip/apps/name/views.py +++ b/coip/apps/name/views.py @@ -51,11 +51,11 @@ def add(request,id): parent = get_object_or_404(Name,pk=id) if id: - if not parent.has_permission(request.user,'i'): + if not parent.has_permission(request.user,'w'): return HttpResponseForbidden('You are not allowed to create names under '+parent) else: if not request.user.admin: - return HttpResponseForbidden('You are not allowed to create names') + return HttpResponseForbidden('You are not allowed to create names in the root') if request.method == 'POST': name = Name(parent=parent,creator=request.user) diff --git a/coip/extensions/templatetags/permdisplay.py b/coip/extensions/templatetags/permdisplay.py index a2b347d..364544e 100644 --- a/coip/extensions/templatetags/permdisplay.py +++ b/coip/extensions/templatetags/permdisplay.py @@ -1,4 +1,7 @@ from django import template +from coip.extensions.templatetags.userdisplay import userdisplay +from string import split +from django.contrib.auth.models import User register = template.Library() @@ -8,14 +11,29 @@ MOMENT = 120 # duration in seconds within which the time difference perms = {'r':'read', 'w':'write', 'd':'delete', - 'i':'insert', - 'l':'list'} + 'i':'manage members', + 'l':'list members'} def permdisplay(perm): if perm: - return "can %s" % (' '.join([perms[p] for p in perm])) + return "can %s" % (', '.join([perms[p] for p in perm])) else: return "can do nothing" - + permdisplay.is_safe = True -register.filter(permdisplay)
\ No newline at end of file +register.filter(permdisplay) + +def acldstdisplay(dst): + if dst.display.startswith("user:"): + (pfx,username) = split(dst.display,":",1) + user = User.objects.get(username=username) + if user: + return userdisplay(user) + else: + return "Unknown user \"%s\"" % username + else: + return "Members of <a tip=\"%s\" href=\"/name/%d\">%s</a>" % (dst.display,dst.id,dst.short) + + +acldstdisplay.is_safe = True +register.filter(acldstdisplay)
\ No newline at end of file diff --git a/coip/multiresponse.py b/coip/multiresponse.py index b3482d0..3831a21 100644 --- a/coip/multiresponse.py +++ b/coip/multiresponse.py @@ -34,7 +34,7 @@ def make_response_dict(request,d={}): name = d['name'] if name: d['render'] = {'delete': name.has_permission(request.user,'d'), - 'insert': name.has_permission(request.user,'i'), + 'insert': name.has_permission(request.user,'w'), 'edit': name.has_permission(request.user,'w'), 'invite': name.has_permission(request.user,'i'), 'up': (name.parent and name.parent.has_permission(request.user,'r')) or not name.parent} diff --git a/templates/apps/name/acls.html b/templates/apps/name/acls.html index 89bbdc2..5b91429 100644 --- a/templates/apps/name/acls.html +++ b/templates/apps/name/acls.html @@ -5,7 +5,7 @@ <table style="margin-bottom: 20px;"> {% for ace in acl %} <tr> - <td>Members of <a href="/name/id/{{ace.dst.id}}">{{ace.dst}} ({{ace.dst.short}})</a></td> + <td>{{ace.dst|acldstdisplay}}</td> <td>{{ace.data|permdisplay}}</td> <td><a href="/namelink/{{ace.id}}/remove"><span class="ui-icon ui-icon-trash"></span></td> </tr> diff --git a/templates/base.html b/templates/base.html index b885446..f3ce14c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -72,19 +72,19 @@ <div class="ui-widget ui-state-default ui-corner-all navlist toolbar"> <ul> {% if render.edit %} - <li><a class="tip" title="Modify access rights" href="/name/{{name.id}}/link/0"><span class="ui-icon ui-icon-unlocked"></span></a></li> + <li><a class="tip" title="Modify Access Rights" href="/name/{{name.id}}/link/0"><span class="ui-icon ui-icon-unlocked"></span></a></li> {% endif %} {% if render.edit %} <li><a class="tip" title="Modify" href="/name/{{name.id}}/edit"><span class="ui-icon ui-icon-wrench"></span></a></li> {% endif %} {% if render.delete %} - <li><a class="tip" title="Permanently remove this" href="/name/{{name.id}}/delete"><span class="ui-icon ui-icon-trash"></span></a></li> + <li><a class="tip" title="Permanently Remove Group" href="/name/{{name.id}}/delete"><span class="ui-icon ui-icon-trash"></span></a></li> {% endif %} {% if render.insert %} - <li><a class="tip" title="Create child" href="/name/{{name.id}}/add"><span class="ui-icon ui-icon-plusthick"></span></a></li> + <li><a class="tip" title="Add Group" href="/name/{{name.id}}/add"><span class="ui-icon ui-icon-plusthick"></span></a></li> {% endif %} {% if render.invite %} - <li><a class="tip" title="Invite someone to join" href="/name/{{name.id}}/invite"><span class="ui-icon ui-icon-heart"></span></a></li> + <li><a class="tip" title="Invite Member" href="/name/{{name.id}}/invite"><span class="ui-icon ui-icon-heart"></span></a></li> {% endif %} <li><a class="tip" title="Refresh" href="/name/id/{{name.id}}"><span class="ui-icon ui-icon-refresh"></span></a></li> </ul> |