MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getLevelFromGroups

Method getLevelFromGroups

plugins/plugin_utils/plugin_HTTP.cpp:585–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583
584
585int BZFSHTTPAuth::getLevelFromGroups(const std::vector<std::string> &groups) {
586 std::map<int, std::vector<std::string> >::reverse_iterator itr = authLevels.rbegin();
587
588 while (itr != authLevels.rend()) {
589 for (size_t s = 0; s < itr->second.size(); s++) {
590 std::string& perm = itr->second[s];
591
592 std::vector<std::string> groupsWithPerm;
593
594 if (compare_nocase(perm, "ADMIN") == 0) {
595 groupsWithPerm = findGroupsWithAdmin();
596 }
597 else {
598 groupsWithPerm = findGroupsWithPerm(perm);
599 }
600
601 // check the input groups, and see if any of the them are in the groups with this perm
602 for (size_t i = 1; i < groups.size(); i++) {
603 if (stringInList(groups[i], groupsWithPerm)) {
604 return itr->first;
605 }
606 }
607 }
608 itr++;
609 }
610 return 0;
611}
612
613void BZFSHTTPAuth::flushTasks(void) {
614 std::map<int, AuthInfo>::iterator authItr = authedSessions.begin();

Callers

nothing calls this directly

Calls 7

findGroupsWithAdminFunction · 0.85
findGroupsWithPermFunction · 0.85
stringInListFunction · 0.85
compare_nocaseFunction · 0.70
rbeginMethod · 0.45
rendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected