mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-10 21:10:17 +02:00
Implement url hooks. Many apps are now removable. Default to assuming services have been migrated.
33 lines
992 B
Python
33 lines
992 B
Python
from services.hooks import MenuItemHook, UrlHook
|
|
from alliance_auth import hooks
|
|
from 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'):
|
|
return MenuItemHook.render(self, request)
|
|
return ''
|
|
|
|
|
|
@hooks.register('menu_item_hook')
|
|
def register_menu():
|
|
return CorpStats()
|
|
|
|
|
|
class CorpStatsUrl(UrlHook):
|
|
def __init__(self):
|
|
UrlHook.__init__(self, urls, 'corputils', r'^corpstats/')
|
|
|
|
|
|
@hooks.register('url_hook')
|
|
def register_url():
|
|
return CorpStatsUrl()
|