diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/fixtures/groups.json | 961 | ||||
-rw-r--r-- | main/templatetags/pgp.py | 19 |
2 files changed, 501 insertions, 479 deletions
diff --git a/main/fixtures/groups.json b/main/fixtures/groups.json index 134b98b3..2205be7c 100644 --- a/main/fixtures/groups.json +++ b/main/fixtures/groups.json @@ -1,475 +1,504 @@ [ - { - "pk": 1, - "model": "auth.group", - "fields": { - "name": "Developers", - "permissions": [ - [ - "change_package", - "main", - "package" - ], - [ - "add_news", - "news", - "news" - ], - [ - "change_news", - "news", - "news" - ], - [ - "add_signoff", - "packages", - "signoff" - ], - [ - "change_signoff", - "packages", - "signoff" - ], - [ - "add_signoffspecification", - "packages", - "signoffspecification" - ], - [ - "change_signoffspecification", - "packages", - "signoffspecification" - ], - [ - "add_todolist", - "todolists", - "todolist" - ], - [ - "change_todolist", - "todolists", - "todolist" - ], - [ - "add_todolistpackage", - "todolists", - "todolistpackage" - ], - [ - "change_todolistpackage", - "todolists", - "todolistpackage" - ], - [ - "delete_todolistpackage", - "todolists", - "todolistpackage" - ] +{ + "fields": { + "name": "Developers", + "permissions": [ + [ + "change_package", + "main", + "package" + ], + [ + "add_news", + "news", + "news" + ], + [ + "change_news", + "news", + "news" + ], + [ + "add_signoff", + "packages", + "signoff" + ], + [ + "change_signoff", + "packages", + "signoff" + ], + [ + "add_signoffspecification", + "packages", + "signoffspecification" + ], + [ + "change_signoffspecification", + "packages", + "signoffspecification" + ], + [ + "add_todolist", + "todolists", + "todolist" + ], + [ + "change_todolist", + "todolists", + "todolist" + ], + [ + "add_todolistpackage", + "todolists", + "todolistpackage" + ], + [ + "change_todolistpackage", + "todolists", + "todolistpackage" + ], + [ + "delete_todolistpackage", + "todolists", + "todolistpackage" ] - } - }, - { - "pk": 2, - "model": "auth.group", - "fields": { - "name": "Trusted Users", - "permissions": [ - [ - "change_package", - "main", - "package" - ], - [ - "add_signoff", - "packages", - "signoff" - ], - [ - "change_signoff", - "packages", - "signoff" - ], - [ - "add_signoffspecification", - "packages", - "signoffspecification" - ], - [ - "change_signoffspecification", - "packages", - "signoffspecification" - ], - [ - "add_todolist", - "todolists", - "todolist" - ], - [ - "change_todolist", - "todolists", - "todolist" - ], - [ - "add_todolistpackage", - "todolists", - "todolistpackage" - ], - [ - "change_todolistpackage", - "todolists", - "todolistpackage" - ], - [ - "delete_todolistpackage", - "todolists", - "todolistpackage" - ] + ] + }, + "model": "auth.group", + "pk": 1 +}, +{ + "fields": { + "name": "Trusted Users", + "permissions": [ + [ + "change_package", + "main", + "package" + ], + [ + "add_signoff", + "packages", + "signoff" + ], + [ + "change_signoff", + "packages", + "signoff" + ], + [ + "add_signoffspecification", + "packages", + "signoffspecification" + ], + [ + "change_signoffspecification", + "packages", + "signoffspecification" + ], + [ + "add_todolist", + "todolists", + "todolist" + ], + [ + "change_todolist", + "todolists", + "todolist" + ], + [ + "add_todolistpackage", + "todolists", + "todolistpackage" + ], + [ + "change_todolistpackage", + "todolists", + "todolistpackage" + ], + [ + "delete_todolistpackage", + "todolists", + "todolistpackage" ] - } - }, - { - "pk": 3, - "model": "auth.group", - "fields": { - "name": "Mirror Maintainers", - "permissions": [ - [ - "add_mirror", - "mirrors", - "mirror" - ], - [ - "change_mirror", - "mirrors", - "mirror" - ], - [ - "delete_mirror", - "mirrors", - "mirror" - ], - [ - "add_mirrorprotocol", - "mirrors", - "mirrorprotocol" - ], - [ - "change_mirrorprotocol", - "mirrors", - "mirrorprotocol" - ], - [ - "add_mirrorrsync", - "mirrors", - "mirrorrsync" - ], - [ - "change_mirrorrsync", - "mirrors", - "mirrorrsync" - ], - [ - "delete_mirrorrsync", - "mirrors", - "mirrorrsync" - ], - [ - "add_mirrorurl", - "mirrors", - "mirrorurl" - ], - [ - "change_mirrorurl", - "mirrors", - "mirrorurl" - ], - [ - "delete_mirrorurl", - "mirrors", - "mirrorurl" - ] + ] + }, + "model": "auth.group", + "pk": 2 +}, +{ + "fields": { + "name": "Mirror Maintainers", + "permissions": [ + [ + "add_mirror", + "mirrors", + "mirror" + ], + [ + "change_mirror", + "mirrors", + "mirror" + ], + [ + "delete_mirror", + "mirrors", + "mirror" + ], + [ + "add_mirrorprotocol", + "mirrors", + "mirrorprotocol" + ], + [ + "change_mirrorprotocol", + "mirrors", + "mirrorprotocol" + ], + [ + "add_mirrorrsync", + "mirrors", + "mirrorrsync" + ], + [ + "change_mirrorrsync", + "mirrors", + "mirrorrsync" + ], + [ + "delete_mirrorrsync", + "mirrors", + "mirrorrsync" + ], + [ + "add_mirrorurl", + "mirrors", + "mirrorurl" + ], + [ + "change_mirrorurl", + "mirrors", + "mirrorurl" + ], + [ + "delete_mirrorurl", + "mirrors", + "mirrorurl" ] - } - }, - { - "pk": 4, - "model": "auth.group", - "fields": { - "name": "User Admins", - "permissions": [ - [ - "add_user", - "auth", - "user" - ], - [ - "change_user", - "auth", - "user" - ], - [ - "add_userprofile", - "devel", - "userprofile" - ], - [ - "change_userprofile", - "devel", - "userprofile" - ] + ] + }, + "model": "auth.group", + "pk": 3 +}, +{ + "fields": { + "name": "User Admins", + "permissions": [ + [ + "add_user", + "auth", + "user" + ], + [ + "change_user", + "auth", + "user" + ], + [ + "change_staffgroup", + "devel", + "staffgroup" + ], + [ + "add_userprofile", + "devel", + "userprofile" + ], + [ + "change_userprofile", + "devel", + "userprofile" ] - } - }, - { - "pk": 5, - "model": "auth.group", - "fields": { - "name": "Release Engineering", - "permissions": [ - [ - "add_architecture", - "releng", - "architecture" - ], - [ - "change_architecture", - "releng", - "architecture" - ], - [ - "delete_architecture", - "releng", - "architecture" - ], - [ - "add_bootloader", - "releng", - "bootloader" - ], - [ - "change_bootloader", - "releng", - "bootloader" - ], - [ - "delete_bootloader", - "releng", - "bootloader" - ], - [ - "add_boottype", - "releng", - "boottype" - ], - [ - "change_boottype", - "releng", - "boottype" - ], - [ - "delete_boottype", - "releng", - "boottype" - ], - [ - "add_clockchoice", - "releng", - "clockchoice" - ], - [ - "change_clockchoice", - "releng", - "clockchoice" - ], - [ - "delete_clockchoice", - "releng", - "clockchoice" - ], - [ - "add_filesystem", - "releng", - "filesystem" - ], - [ - "change_filesystem", - "releng", - "filesystem" - ], - [ - "delete_filesystem", - "releng", - "filesystem" - ], - [ - "add_hardwaretype", - "releng", - "hardwaretype" - ], - [ - "change_hardwaretype", - "releng", - "hardwaretype" - ], - [ - "delete_hardwaretype", - "releng", - "hardwaretype" - ], - [ - "add_installtype", - "releng", - "installtype" - ], - [ - "change_installtype", - "releng", - "installtype" - ], - [ - "delete_installtype", - "releng", - "installtype" - ], - [ - "add_iso", - "releng", - "iso" - ], - [ - "change_iso", - "releng", - "iso" - ], - [ - "delete_iso", - "releng", - "iso" - ], - [ - "add_isotype", - "releng", - "isotype" - ], - [ - "change_isotype", - "releng", - "isotype" - ], - [ - "delete_isotype", - "releng", - "isotype" - ], - [ - "add_module", - "releng", - "module" - ], - [ - "change_module", - "releng", - "module" - ], - [ - "delete_module", - "releng", - "module" - ], - [ - "add_release", - "releng", - "release" - ], - [ - "change_release", - "releng", - "release" - ], - [ - "delete_release", - "releng", - "release" - ], - [ - "add_source", - "releng", - "source" - ], - [ - "change_source", - "releng", - "source" - ], - [ - "delete_source", - "releng", - "source" - ], - [ - "add_test", - "releng", - "test" - ], - [ - "change_test", - "releng", - "test" - ], - [ - "delete_test", - "releng", - "test" - ] + ] + }, + "model": "auth.group", + "pk": 4 +}, +{ + "fields": { + "name": "Release Engineering", + "permissions": [ + [ + "add_architecture", + "releng", + "architecture" + ], + [ + "change_architecture", + "releng", + "architecture" + ], + [ + "delete_architecture", + "releng", + "architecture" + ], + [ + "add_bootloader", + "releng", + "bootloader" + ], + [ + "change_bootloader", + "releng", + "bootloader" + ], + [ + "delete_bootloader", + "releng", + "bootloader" + ], + [ + "add_boottype", + "releng", + "boottype" + ], + [ + "change_boottype", + "releng", + "boottype" + ], + [ + "delete_boottype", + "releng", + "boottype" + ], + [ + "add_clockchoice", + "releng", + "clockchoice" + ], + [ + "change_clockchoice", + "releng", + "clockchoice" + ], + [ + "delete_clockchoice", + "releng", + "clockchoice" + ], + [ + "add_filesystem", + "releng", + "filesystem" + ], + [ + "change_filesystem", + "releng", + "filesystem" + ], + [ + "delete_filesystem", + "releng", + "filesystem" + ], + [ + "add_hardwaretype", + "releng", + "hardwaretype" + ], + [ + "change_hardwaretype", + "releng", + "hardwaretype" + ], + [ + "delete_hardwaretype", + "releng", + "hardwaretype" + ], + [ + "add_installtype", + "releng", + "installtype" + ], + [ + "change_installtype", + "releng", + "installtype" + ], + [ + "delete_installtype", + "releng", + "installtype" + ], + [ + "add_iso", + "releng", + "iso" + ], + [ + "change_iso", + "releng", + "iso" + ], + [ + "delete_iso", + "releng", + "iso" + ], + [ + "add_isotype", + "releng", + "isotype" + ], + [ + "change_isotype", + "releng", + "isotype" + ], + [ + "delete_isotype", + "releng", + "isotype" + ], + [ + "add_module", + "releng", + "module" + ], + [ + "change_module", + "releng", + "module" + ], + [ + "delete_module", + "releng", + "module" + ], + [ + "add_release", + "releng", + "release" + ], + [ + "change_release", + "releng", + "release" + ], + [ + "delete_release", + "releng", + "release" + ], + [ + "add_source", + "releng", + "source" + ], + [ + "change_source", + "releng", + "source" + ], + [ + "delete_source", + "releng", + "source" + ], + [ + "add_test", + "releng", + "test" + ], + [ + "change_test", + "releng", + "test" + ], + [ + "delete_test", + "releng", + "test" ] - } - }, - { - "pk": 6, - "model": "auth.group", - "fields": { - "name": "Package Relation Maintainers", - "permissions": [ - [ - "add_packagerelation", - "packages", - "packagerelation" - ], - [ - "change_packagerelation", - "packages", - "packagerelation" - ], - [ - "delete_packagerelation", - "packages", - "packagerelation" - ] + ] + }, + "model": "auth.group", + "pk": 5 +}, +{ + "fields": { + "name": "Package Relation Maintainers", + "permissions": [ + [ + "add_packagerelation", + "packages", + "packagerelation" + ], + [ + "change_packagerelation", + "packages", + "packagerelation" + ], + [ + "delete_packagerelation", + "packages", + "packagerelation" ] - } - }, - { - "pk": 8, - "model": "auth.group", - "fields": { - "name": "Download Page Releases", - "permissions": [ - [ - "add_release", - "releng", - "release" - ], - [ - "change_release", - "releng", - "release" - ], - [ - "delete_release", - "releng", - "release" - ] + ] + }, + "model": "auth.group", + "pk": 6 +}, +{ + "fields": { + "name": "Download Page Releases", + "permissions": [ + [ + "add_release", + "releng", + "release" + ], + [ + "change_release", + "releng", + "release" + ], + [ + "delete_release", + "releng", + "release" ] - } - } + ] + }, + "model": "auth.group", + "pk": 8 +}, +{ + "fields": { + "name": "Retired Developers", + "permissions": [] + }, + "model": "auth.group", + "pk": 9 +}, +{ + "fields": { + "name": "Retired Trusted Users", + "permissions": [] + }, + "model": "auth.group", + "pk": 10 +}, +{ + "fields": { + "name": "Support Staff", + "permissions": [] + }, + "model": "auth.group", + "pk": 11 +} ] diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py index 2417f688..455e8f9c 100644 --- a/main/templatetags/pgp.py +++ b/main/templatetags/pgp.py @@ -44,21 +44,14 @@ def pgp_key_link(key_id, link_text=None): return '<a href="%s" title="PGP key search for %s">%s</a>' % values -@cache_function(1741) -def name_for_key(normalized): - try: - matching_key = DeveloperKey.objects.select_related( - 'owner').get(key=normalized, owner_id__isnull=False) - return matching_key.owner.get_full_name() - except DeveloperKey.DoesNotExist: - return None - - @register.simple_tag -def user_pgp_key_link(key_id): +def user_pgp_key_link(dev_keys, key_id): normalized = key_id[-16:] - name = name_for_key(normalized) - return pgp_key_link(key_id, name) + found = dev_keys.get(normalized, None) + if found: + return pgp_key_link(key_id, found.owner.get_full_name()) + else: + return pgp_key_link(key_id, None) @register.filter(needs_autoescape=True) |