mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-10 09:06:21 +01:00
Restructure Alliance Auth package (#867)
* Refactor allianceauth into its own package * Add setup * Add missing default_app_config declarations * Fix timerboard namespacing * Remove obsolete future imports * Remove py2 mock support * Remove six * Add experimental 3.7 support and multiple Dj versions * Remove python_2_unicode_compatible * Add navhelper as local package * Update requirements
This commit is contained in:
29
allianceauth/permissions_tool/auth_hooks.py
Normal file
29
allianceauth/permissions_tool/auth_hooks.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from . import urls
|
||||
|
||||
from allianceauth import hooks
|
||||
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
||||
|
||||
|
||||
class PermissionsTool(MenuItemHook):
|
||||
def __init__(self):
|
||||
MenuItemHook.__init__(self,
|
||||
'Permissions Audit',
|
||||
'fa fa-key fa-id-card grayiconecolor',
|
||||
'permissions_tool:overview',
|
||||
order=400,
|
||||
navactive=['permissions_tool:'])
|
||||
|
||||
def render(self, request):
|
||||
if request.user.has_perm('permissions_tool.audit_permissions'):
|
||||
return MenuItemHook.render(self, request)
|
||||
return ''
|
||||
|
||||
|
||||
@hooks.register('menu_item_hook')
|
||||
def register_menu():
|
||||
return PermissionsTool()
|
||||
|
||||
|
||||
@hooks.register('url_hook')
|
||||
def register_url():
|
||||
return UrlHook(urls, 'permissions_tool', r'^permissions/')
|
||||
Reference in New Issue
Block a user