--- a/mod_auth_jetbrains_hub.lua Thu Oct 24 04:55:25 2019 -0500
+++ b/mod_auth_jetbrains_hub.lua Thu Oct 24 05:11:15 2019 -0500
@@ -17,7 +17,7 @@
local host = module.host;
-local hub_url = module:get_option_string("jetbrains_hub_url", ""):gsub("$host", host);
+local hub_url = module:get_option_string("jetbrains_hub_url", ""):gsub("$host", host); if hub_url == "" then error("jetbrains_hub_url required") end
local hub_scopes = module:get_option_string("jetbrains_hub_scopes", "");
@@ -33,6 +33,31 @@
-- we only need to update the group part of the query once on load so do it
+local function get_group_query() + -- if there's no groups, just return an empty string + if #hub_groups == 0 then + -- we have at least one group, so output the start of our query + for i, v in ipairs(hub_groups) do + -- add the group making sure to quote it as spaces are allowed and will + -- fail if they're not quoted. + query = query .. "in:\"" .. v .. "\"" + -- if we have additional groups add our "or" separator between the + if i < #hub_groups then + query = query .. " or " + -- finally add our closing paren and return the query local group_query = get_group_query()
@@ -103,31 +128,6 @@
-local function get_group_query()
- -- if there's no groups, just return an empty string
- if #hub_groups == 0 then
- -- we have at least one group, so output the start of our query
- for i, v in ipairs(hub_groups) do
- -- add the group making sure to quote it as spaces are allowed and will
- -- fail if they're not quoted.
- query = query .. "in:\"" .. v .. "\""
- -- if we have additional groups add our "or" separator between the
- if i < #hub_groups then
- query = query .. " or "
- -- finally add our closing paren and return the query
local function check_group(username, token)
local headers = { Authorization = "Bearer "..token; };