mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-14 19:16:23 +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:
30
allianceauth/corputils/auth_hooks.py
Normal file
30
allianceauth/corputils/auth_hooks.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
||||
|
||||
from allianceauth import hooks
|
||||
from allianceauth.corputils import urls
|
||||
|
||||
|
||||
class CorpStats(MenuItemHook):
|
||||
def __init__(self):
|
||||
MenuItemHook.__init__(self,
|
||||
'Corporation Stats',
|
||||
'fa fa-share-alt fa-fw grayiconecolor',
|
||||
'corputils:view',
|
||||
navactive=['corputils:'])
|
||||
|
||||
def render(self, request):
|
||||
if request.user.has_perm('corputils.view_corp_corpstats') or request.user.has_perm(
|
||||
'corputils.view_alliance_corpstats') or request.user.has_perm(
|
||||
'corputils.add_corpstats') or request.user.has_perm('corputils.view_state_corpstats'):
|
||||
return MenuItemHook.render(self, request)
|
||||
return ''
|
||||
|
||||
|
||||
@hooks.register('menu_item_hook')
|
||||
def register_menu():
|
||||
return CorpStats()
|
||||
|
||||
|
||||
@hooks.register('url_hook')
|
||||
def register_url():
|
||||
return UrlHook(urls, 'corputils', r'^corpstats/')
|
||||
Reference in New Issue
Block a user