3232-- Properties that can be set by this validator:
3333-- 1. user_email
3434-- 2. user_country_code
35- -- 3. user_region
36- -- 4. user_name
35+ -- 3. user_name
3736--
3837-- User: ddascal
3938-- Date: 17/12/13
@@ -54,16 +53,6 @@ local RESPONSES = {
5453 NOT_ALLOWED = { error_code = " 403024" , message = " Not allowed to read the profile" },
5554 P_UNKNOWN_ERROR = { error_code = " 503020" , message = " Could not read the profile" }
5655}
57- ---
58- -- @field US - countries mapping to US region
59- -- @field EU - countries mapping to EU region
60- -- @field AP - countries mapping to AP region
61- --
62- local DEFAULT_COUNTRY_MAP = {
63- US = { " AG" , " AI" , " AN" , " AR" , " AS" , " AW" , " BB" , " BL" , " BM" , " BO" , " BQ" , " BR" , " BS" , " BZ" , " CA" , " CL" , " CO" , " CR" , " CU" , " CW" , " DM" , " DO" , " EC" , " FK" , " GD" , " GF" , " GP" , " GS" , " GT" , " GY" , " HN" , " HT" , " JM" , " KN" , " KY" , " LC" , " MP" , " MQ" , " MS" , " MX" , " NI" , " PA" , " PE" , " PM" , " PR" , " PY" , " SR" , " SV" , " SX" , " TC" , " TT" , " UM" , " US" , " UY" , " VC" , " VE" , " VG" , " VI" },
64- EU = { " AD" , " AL" , " AM" , " AO" , " AT" , " AX" , " AZ" , " BA" , " BE" , " BF" , " BG" , " BI" , " BJ" , " BV" , " BW" , " BY" , " CD" , " CF" , " CG" , " CH" , " CI" , " CM" , " CS" , " CV" , " CY" , " CZ" , " DE" , " DJ" , " DK" , " DZ" , " EE" , " EG" , " EH" , " ER" , " ES" , " ET" , " FI" , " FO" , " FR" , " GA" , " GB" , " GE" , " GG" , " GH" , " GI" , " GL" , " GM" , " GN" , " GQ" , " GR" , " GW" , " HR" , " HU" , " IE" , " IM" , " IO" , " IR" , " IS" , " IT" , " JE" , " KE" , " KM" , " KP" , " KV" , " LI" , " LR" , " LS" , " LT" , " LU" , " LV" , " LY" , " MA" , " MC" , " MD" , " ME" , " MF" , " MG" , " MK" , " ML" , " MR" , " MT" , " MU" , " MW" , " MZ" , " NA" , " NE" , " NG" , " NL" , " NO" , " PL" , " PS" , " PT" , " RE" , " RO" , " RS" , " RW" , " SC" , " SD" , " SE" , " SH" , " SI" , " SJ" , " SK" , " SL" , " SM" , " SN" , " SO" , " SS" , " ST" , " SY" , " SZ" , " TD" , " TF" , " TG" , " TN" , " TZ" , " UA" , " UG" , " VA" , " YT" , " ZA" , " ZM" , " ZW" },
65- AP = { " AE" , " AF" , " AQ" , " AU" , " BD" , " BH" , " BN" , " BT" , " CC" , " CK" , " CN" , " CX" , " FJ" , " FM" , " GU" , " HK" , " HM" , " ID" , " IL" , " IN" , " IQ" , " IR" , " JO" , " JP" , " KG" , " KH" , " KI" , " KR" , " KW" , " KZ" , " LA" , " LB" , " LK" , " MH" , " MM" , " MN" , " MO" , " MV" , " MY" , " NC" , " NF" , " NP" , " NR" , " NU" , " NZ" , " OM" , " PF" , " PG" , " PH" , " PK" , " PN" , " PW" , " QA" , " RU" , " SA" , " SB" , " SG" , " TH" , " TJ" , " TK" , " TL" , " TM" , " TO" , " TR" , " TV" , " TW" , " UZ" , " VN" , " VU" , " WF" , " WS" , " YE" }
66- }
6756
6857---
6958-- Maximum time in seconds specifying how long to cache a valid token in GW's memory
@@ -151,24 +140,6 @@ function _M:isProfileValid(cachedProfile)
151140 return true
152141end
153142
154- ---
155- -- Returns an object mapping countries to regions
156- function _M :getDefaultCountryMap ()
157- return DEFAULT_COUNTRY_MAP
158- end
159-
160- function _M :getUserRegion ( user_country_code , country_map )
161- local cmap = country_map or self :getDefaultCountryMap ()
162- for region ,countries in pairs (cmap ) do
163- for i , countryCode in pairs (countries ) do
164- if user_country_code == countryCode then
165- return region
166- end
167- end
168- end
169- return " US"
170- end
171-
172143---
173144-- Returns an object with a set of variables to be saved in the request's context and later in the request's vars
174145-- IMPORTANT: This method is only called when fetching a new profile, otherwise the information from the cache
@@ -180,7 +151,6 @@ function _M:extractContextVars(profile)
180151 cachingObj .user_email = profile .email
181152 cachingObj .user_country_code = profile .countryCode
182153 cachingObj .user_name = profile .displayName
183- cachingObj .user_region = self :getUserRegion (profile .countryCode )
184154 cachingObj .user_first_name = profile .first_name
185155 cachingObj .user_last_name = profile .last_name
186156 return cachingObj
0 commit comments