Skip to content

Commit 6b9e475

Browse files
chore: refactor
1 parent 00db681 commit 6b9e475

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

auth-plugin/plugin_libcurl.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,15 @@ enum class Allowed_Access {
143143
pump,
144144
};
145145

146-
bool allow_user_access(const std::string &username)
147-
{
148-
const std::map<Allowed_Access, std::string> allowmap = {
149-
{Allowed_Access::playbook, "playbook"},
150-
{Allowed_Access::sportsClient, "sports-client"},
151-
{Allowed_Access::bettingClient, "anonymous-betting-client"},
152-
{Allowed_Access::pump, "pump"},
153-
};
154-
155-
for (const auto &kv : allowmap) {
156-
if (kv.second == username) {
157-
return true;
158-
}
159-
}
160-
return false;
146+
bool allow_user_access(const std::string &username) {
147+
static const std::vector<std::string> allowed_users = {
148+
"playbook",
149+
"sports-client",
150+
"anonymous-betting-client",
151+
"pump"
152+
};
153+
154+
return std::find(allowed_users.begin(), allowed_users.end(), username) != allowed_users.end();
161155
}
162156

163157
std::string get_env_var( std::string const & key )

0 commit comments

Comments
 (0)