Skip to content

Commit aaf51ed

Browse files
chore: refactor
1 parent 00db681 commit aaf51ed

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

auth-plugin/plugin_libcurl.cpp

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -136,28 +136,16 @@ void flashmq_plugin_poll_event_received(void *thread_data, int fd, uint32_t even
136136

137137

138138

139-
enum class Allowed_Access {
140-
playbook,
141-
bettingClient,
142-
sportsClient,
143-
pump,
144-
};
145-
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;
139+
140+
bool allow_user_access(const std::string &username) {
141+
const std::vector<std::string> allowed_users = {
142+
"playbook",
143+
"sports-client",
144+
"anonymous-betting-client",
145+
"pump"
146+
};
147+
148+
return std::find(allowed_users.begin(), allowed_users.end(), username) != allowed_users.end();
161149
}
162150

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

0 commit comments

Comments
 (0)