コード例 #1
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'ips4'
     self.urlpatterns = urlpatterns
     self.service_url = settings.IPS4_URL
     self.access_perm = 'ips4.access_ips4'
     self.name_format = '{character_name}'
コード例 #2
0
ファイル: auth_hooks.py プロジェクト: TargetZ3R0/BADI-AAUTH
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.name = 'seat'
     self.service_url = settings.SEAT_URL
     self.access_perm = 'seat.access_seat'
     self.name_format = '{character_name}'
コード例 #3
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'smf'
     self.urlpatterns = urlpatterns
     self.service_url = settings.SMF_URL
     self.access_perm = 'smf.access_smf'
     self.name_format = '{character_name}'
コード例 #4
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.name = 'discord'
     self.service_ctrl_template = 'services/discord/discord_service_ctrl.html'
     self.access_perm = 'discord.access_discord'
     self.name_format = '{character_name}'
コード例 #5
0
ファイル: auth_hooks.py プロジェクト: TargetZ3R0/BADI-AAUTH
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'ips4'
     self.urlpatterns = urlpatterns
     self.service_url = settings.IPS4_URL
     self.access_perm = 'ips4.access_ips4'
     self.name_format = '{character_name}'
コード例 #6
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.name = 'discourse'
     self.service_ctrl_template = 'services/discourse/discourse_service_ctrl.html'
     self.access_perm = 'discourse.access_discourse'
     self.name_format = '{character_name}'
コード例 #7
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.name = 'Wiki JS'
     self.service_url = settings.WIKIJS_URL
     self.access_perm = 'wikijs.access_wikijs'
     self.name_format = '{character_name}'
コード例 #8
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'openfire'
     self.urlpatterns = urlpatterns
     self.service_url = settings.JABBER_URL
     self.access_perm = 'openfire.access_openfire'
     self.name_format = '{character_name}'
コード例 #9
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'teamspeak3'
     self.urlpatterns = urlpatterns
     self.service_ctrl_template = 'services/teamspeak3/teamspeak3_service_ctrl.html'
     self.access_perm = 'teamspeak3.access_teamspeak3'
     self.name_format = '[{corp_ticker}]{character_name}'
コード例 #10
0
ファイル: auth_hooks.py プロジェクト: TargetZ3R0/BADI-AAUTH
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'phpbb3'
     self.urlpatterns = urlpatterns
     self.service_url = settings.PHPBB3_URL
     self.access_perm = 'phpbb3.access_phpbb3'
     self.name_format = '{character_name}'
コード例 #11
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'phpbb3'
     self.urlpatterns = urlpatterns
     self.service_url = settings.PHPBB3_URL
     self.access_perm = 'phpbb3.access_phpbb3'
     self.name_format = '{character_name}'
コード例 #12
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'mumble'
     self.urlpatterns = urlpatterns
     self.service_url = settings.MUMBLE_URL
     self.access_perm = 'mumble.access_mumble'
     self.service_ctrl_template = 'services/mumble/mumble_service_ctrl.html'
     self.name_format = '[{corp_ticker}]{character_name}'
コード例 #13
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'mumble'
     self.urlpatterns = urlpatterns
     self.service_url = settings.MUMBLE_URL
     self.access_perm = 'mumble.access_mumble'
     self.service_ctrl_template = 'services/mumble/mumble_service_ctrl.html'
     self.name_format = '[{corp_ticker}]{character_name}'
コード例 #14
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'market'
     self.urlpatterns = urlpatterns
     self.service_url = settings.MARKET_URL
     self.access_perm = 'market.access_market'
コード例 #15
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'standingsrequests'
     self.urlpatterns = urlpatterns
     self.access_perm = 'standingsrequests.request_standings'
コード例 #16
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.service_url = 'http://exampleservice.example.com'
     self.name = 'example'
コード例 #17
0
ファイル: auth_hooks.py プロジェクト: Kaezon/allianceauth
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'xenforo'
     self.urlpatterns = urlpatterns
     self.access_perm = 'xenforo.access_xenforo'
     self.name_format = '{character_name}'
コード例 #18
0
    def get_stats(self):
        """
        return all corpstats for corp

        :return:
        Mains with Alts Dict
        Members List[EveCharacter]
        Un-registered QuerySet[CorpMember]
        """

        linked_chars = EveCharacter.objects.filter(
            corporation_id=self.corp.corporation_id
        )  # get all authenticated characters in corp from auth internals
        linked_chars = linked_chars | EveCharacter.objects.filter(
            character_ownership__user__profile__main_character__corporation_id=
            self.corp.corporation_id)  # add all alts for characters in corp

        services = [svc.name
                    for svc in ServicesHook.get_services()]  # services list

        linked_chars = linked_chars.select_related('character_ownership',
                                                    'character_ownership__user__profile__main_character') \
            .prefetch_related('character_ownership__user__character_ownerships') \

        skiped_services = []
        for service in services:
            if service in SERVICE_DB:
                linked_chars = linked_chars.select_related(
                    "character_ownership__user__{}".format(
                        SERVICE_DB[service]))
            else:
                skiped_services.append(service)
                logger.error(f"Unknown Service {service} Skipping")

        for service in skiped_services:
            services.remove(service)

        linked_chars = linked_chars.order_by('character_name')  # order by name

        members = []  # member list
        orphans = []  # orphan list
        alt_count = 0  #
        services_count = {}  # for the stats
        for service in services:
            services_count[service] = 0  # prefill

        mains = {}  # main list
        temp_ids = []  # filter out linked vs unreg'd
        for char in linked_chars:
            try:
                main = char.character_ownership.user.profile.main_character  # main from profile
                if main is not None:
                    if main.corporation_id == self.corp.corporation_id:  # iis this char in corp
                        if main.character_id not in mains:  # add array
                            mains[main.character_id] = {
                                'main': main,
                                'alts': [],
                                'services': {}
                            }
                            for service in services:
                                mains[main.character_id]['services'][
                                    service] = False  # pre fill

                        if char.character_id == main.character_id:
                            for service in services:
                                try:
                                    if hasattr(char.character_ownership.user,
                                               SERVICE_DB[service]):
                                        mains[main.character_id]['services'][
                                            service] = True
                                        services_count[service] += 1
                                except Exception as e:
                                    logger.error(e)

                        mains[main.character_id]['alts'].append(
                            char)  #add to alt listing

                    if char.corporation_id == self.corp.corporation_id:
                        members.append(
                            char)  # add to member listing as a known char
                        if not char.character_id == main.character_id:
                            alt_count += 1
                        if main.corporation_id != self.corp.corporation_id:
                            orphans.append(char)

                    temp_ids.append(
                        char.character_id)  # exclude from un-authed

            except ObjectDoesNotExist:  # main not found we are unauthed
                pass

        unregistered = CorpMember.objects.filter(corpstats=self).exclude(
            character_id__in=temp_ids)  # filter corpstat list for unknowns
        tracking = CorpMember.objects.filter(corpstats=self).filter(
            character_id__in=temp_ids)  # filter corpstat list for unknowns

        # yay maths
        total_mains = len(mains)
        total_unreg = len(unregistered)
        total_members = len(members) + total_unreg  # is unreg + known
        # yay more math
        auth_percent = len(members) / total_members * 100
        alt_ratio = 0

        try:
            alt_ratio = total_mains / alt_count
        except:
            pass
        # services
        service_percent = {}
        for service in services:
            if service in SERVICE_DB:
                try:
                    service_percent[service] = {
                        "cnt": services_count[service],
                        "percent": services_count[service] / total_mains * 100
                    }
                except Exception as e:
                    service_percent[service] = {
                        "cnt": services_count[service],
                        "percent": 0
                    }

        return members, mains, orphans, unregistered, total_mains, total_unreg, total_members, auth_percent, alt_ratio, service_percent, tracking, services
コード例 #19
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'xenforo'
     self.urlpatterns = urlpatterns
     self.access_perm = 'xenforo.access_xenforo'
     self.name_format = '{character_name}'
コード例 #20
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.name = 'market'
     self.urlpatterns = urlpatterns
     self.service_url = settings.MARKET_URL
     self.access_perm = 'market.access_market'
コード例 #21
0
 def __init__(self):
     ServicesHook.__init__(self)
     self.urlpatterns = urlpatterns
     self.service_url = 'http://exampleservice.example.com'
     self.name = 'example'