diff --git a/hack-a-vpn.py b/hack-a-vpn.py index 0956cd5..e6bfb43 100644 --- a/hack-a-vpn.py +++ b/hack-a-vpn.py @@ -5,6 +5,23 @@ import json import logging from functools import wraps +from ldaptest import is_valid_ldap_user + +def authenticate(func): + @wraps(func) + def wrapper(*args, **kwargs): + if not getattr(func, 'authenticated', True): + return func(*args, **kwargs) + + # pass in username/password ! + acct = basic_authentication() # custom account lookup function + + if acct: + return func(*args, **kwargs) + + flask_restful.abort(401) + return wrapper + def readable_errors(func): @wraps(func) def wrapper(*args, **kwargs): @@ -147,6 +164,22 @@ See https://redmine.ungleich.ch/issues/7747? ] } ) + self.products.append( + { "name": "ipv6-vpn-with-/48", + "description": """ +An IPv6 VPN with a /48 network included. +""", + "uuid": "fe5753f8-6fe1-4dc4-9b73-7b803de4c597", + "recurring": True, + "recurring_time_frame": "per_year", + "features": [ + { "name": "vpn", + "price_one_time": 0, + "price_recurring": 120 + } + ] + } + ) @staticmethod diff --git a/hack.org b/hack.org new file mode 100644 index 0000000..e69de29 diff --git a/nicohack202002/uncloud/.gitignore b/nicohack202002/uncloud/.gitignore new file mode 100644 index 0000000..49ef255 --- /dev/null +++ b/nicohack202002/uncloud/.gitignore @@ -0,0 +1 @@ +db.sqlite3 diff --git a/notes-nico.org b/notes-nico.org index 9e88215..e2b8cac 100644 --- a/notes-nico.org +++ b/notes-nico.org @@ -1,3 +1,13 @@ +* python requirements (nicohack202002) + django djangorestframework +* VPN case +** put on /orders with uuid +** register cc +* CC +** TODO check whether we can register or not at stripe +* membership +** required for "smaller" / "shorter" products + * TODO Membership missing * Flows to be implemented - see https://redmine.ungleich.ch/issues/7609 ** Membership diff --git a/ucloud_pay.py b/ucloud_pay.py index 09c5813..f2c9e01 100644 --- a/ucloud_pay.py +++ b/ucloud_pay.py @@ -33,7 +33,6 @@ class ListProducts(Resource): logger.debug('Products = {}'.format(prod_dict)) return prod_dict, 200 - class AddProduct(Resource): @staticmethod def post(): @@ -68,6 +67,9 @@ class AddProduct(Resource): else: return make_return_message('Product updated.') +################################################################################ +# Nico-ok-marker + class UserRegisterPayment(Resource): @staticmethod