Esempio n. 1
0
    def has_permission(self, request, view):
        start = Config.get(key='start_at')
        now = datetime.datetime.utcnow().replace(tzinfo=utc)

        if start:
            if start > now:
                raise TimeException(message="CTF isn't started.", error="NOT_STARTED")

        return True
Esempio n. 2
0
    def has_permission(self, request, view):
        end = Config.get(key='end_at')
        now = datetime.datetime.utcnow().replace(tzinfo=utc)

        if end:
            if end < now:
                raise TimeException(message="CTF closed.", error="CLOSED")

        return True
Esempio n. 3
0
    def has_permission(self, request, view):
        end = Config.get(key='end_at')
        now = datetime.datetime.utcnow().replace(tzinfo=utc)

        if end:
            if end < now:
                raise TimeException(message="CTF closed.", error="CLOSED")

        return True
Esempio n. 4
0
    def has_permission(self, request, view):
        start = Config.get(key='start_at')
        now = datetime.datetime.utcnow().replace(tzinfo=utc)

        if start:
            if start > now:
                raise TimeException(message="CTF isn't started.",
                                    error="NOT_STARTED")

        return True