| 1022 | } |
| 1023 | |
| 1024 | uint8_t NetworkBase::GetGroupIDByHash(const std::string& keyhash) |
| 1025 | { |
| 1026 | const User* networkUser = _userManager.getUserByHash(keyhash); |
| 1027 | |
| 1028 | uint8_t groupId = GetDefaultGroup(); |
| 1029 | if (networkUser != nullptr && networkUser->groupId.has_value()) |
| 1030 | { |
| 1031 | const uint8_t assignedGroup = *networkUser->groupId; |
| 1032 | if (GetGroupByID(assignedGroup) != nullptr) |
| 1033 | { |
| 1034 | groupId = assignedGroup; |
| 1035 | } |
| 1036 | else |
| 1037 | { |
| 1038 | LOG_WARNING( |
| 1039 | "User %s is assigned to non-existent group %u. Assigning to default group (%u)", keyhash.c_str(), |
| 1040 | assignedGroup, groupId); |
| 1041 | } |
| 1042 | } |
| 1043 | return groupId; |
| 1044 | } |
| 1045 | |
| 1046 | uint8_t NetworkBase::GetDefaultGroup() const noexcept |
| 1047 | { |
nothing calls this directly
no test coverage detected