From 8cc5ba134f6c5a1a06d91407aa78b962545c54ac Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 17 Apr 2014 11:42:13 +0200 Subject: initial commit for the service level api :api/service will return a hash of the current users service level This is failiing if the user is not logged in. Instead it should return the service description for an anonymous user. --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/routes.rb b/config/routes.rb index b930bd1..f612b47 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,6 +25,7 @@ LeapWeb::Application.routes.draw do resources :users, :only => [:create, :update, :destroy, :index] resources :messages, :only => [:index, :update] resource :cert, :only => [:show] + resource :service, :only => [:show] end scope "(:locale)", :locale => MATCH_LOCALE do -- cgit v1.2.3 From 614745c84cab37dd03f2bd8f06160fd01c7fabdb Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 17 Apr 2014 12:06:38 +0200 Subject: UnauthenticatedUser as current_user this still allows us to do current_user.service_level. Have not gone through the rest of the code yet. Only made sure logged_in? now tests for is_a? User instead of !!current_user --- config/defaults.yml | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/defaults.yml b/config/defaults.yml index e7d0f5e..47c3ad7 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -67,6 +67,7 @@ service_levels: &service_levels USD: 10 EUR: 10 default_service_level: 1 + unauthenticated_service_level: 0 development: <<: *downloads -- cgit v1.2.3 From 7a9ece43bd61246b450471ed6bb1089570321e38 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 17 Apr 2014 19:27:47 +0200 Subject: make use of the UnauthorizedUser Null Pattern for current_user - use it to get rid of some conditionals --- config/defaults.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'config') diff --git a/config/defaults.yml b/config/defaults.yml index 47c3ad7..383aa1c 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -7,11 +7,6 @@ cert_options: &cert_options client_cert_lifespan: 2 client_cert_bit_size: 2024 client_cert_hash: "SHA256" - allow_limited_certs: false - allow_unlimited_certs: true - allow_anonymous_certs: false - limited_cert_prefix: "LIMITED" - unlimited_cert_prefix: "UNLIMITED" downloads: &downloads client_download_domain: https://dl.bitmask.net @@ -53,12 +48,17 @@ service_levels: &service_levels name: anonymous cert_prefix: "LIMITED" description: "anonymous account, with rate limited VPN" + services: + - eip 1: name: free cert_prefix: "LIMITED" description: "free account, with rate limited VPN" cost: 0 quota: 100 + services: + - eip + - email 2: name: premium cert_prefix: "UNLIMITED" @@ -66,6 +66,9 @@ service_levels: &service_levels cost: USD: 10 EUR: 10 + services: + - eip + - email default_service_level: 1 unauthenticated_service_level: 0 -- cgit v1.2.3 From 9216ab8252246a263c5d17f6755a7d3887145f94 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 18 Apr 2014 11:55:40 +0200 Subject: change service level configuration strategy The changes to the configuration required some non minor changes to the platform and also added some flexibility we don't require yet - and thus some new possibilities for errors. So instead we still use the allow_..._certs and ..._cert_prefix options. They basically provide the framework in which service levels can operate. The service level configuration will not include the cert prefix anymore. It only states if the service level is rate limited or not. This avoids conflicts between the two configuration options. I also removed the anonymous service level entirely. It was also turning a boolean decision (do we provide anonymous eip or not) into something way more complex. Instead I added the AnonymousServiceLevel class to handle the corner cases for people who are not logged in. Furthermore i renamed the UnauthenticatedUser to AnonymousUser so it matches the Anonymous Service Level nicely. It's also shorter and more intuitive. --- config/defaults.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'config') diff --git a/config/defaults.yml b/config/defaults.yml index 383aa1c..a7b70a3 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -7,6 +7,11 @@ cert_options: &cert_options client_cert_lifespan: 2 client_cert_bit_size: 2024 client_cert_hash: "SHA256" + allow_limited_certs: false + allow_unlimited_certs: true + allow_anonymous_certs: false + limited_cert_prefix: "LIMITED" + unlimited_cert_prefix: "UNLIMITED" downloads: &downloads client_download_domain: https://dl.bitmask.net @@ -44,33 +49,19 @@ common: &common service_levels: &service_levels service_levels: - 0: - name: anonymous - cert_prefix: "LIMITED" - description: "anonymous account, with rate limited VPN" - services: - - eip 1: name: free - cert_prefix: "LIMITED" description: "free account, with rate limited VPN" cost: 0 + eip_rate_limit: true quota: 100 - services: - - eip - - email 2: name: premium - cert_prefix: "UNLIMITED" description: "premium account, with unlimited vpn" cost: USD: 10 EUR: 10 - services: - - eip - - email default_service_level: 1 - unauthenticated_service_level: 0 development: <<: *downloads -- cgit v1.2.3 From be81b7430e0a2046125be7c3a4b01b8725f4afe6 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 18 Apr 2014 12:51:18 +0200 Subject: adopt service_level config to platform settings cost -> rate quota -> storage --- config/defaults.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'config') diff --git a/config/defaults.yml b/config/defaults.yml index a7b70a3..47cb641 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -52,13 +52,12 @@ service_levels: &service_levels 1: name: free description: "free account, with rate limited VPN" - cost: 0 eip_rate_limit: true - quota: 100 + storage: 100 2: name: premium description: "premium account, with unlimited vpn" - cost: + rate: USD: 10 EUR: 10 default_service_level: 1 -- cgit v1.2.3