| 1173 | } |
| 1174 | |
| 1175 | AdminId AdminCache::FindAdminByIdentity(const char *auth, const char *identity) |
| 1176 | { |
| 1177 | AuthMethod *method; |
| 1178 | if (!m_AuthTables.retrieve(auth, &method)) |
| 1179 | return INVALID_ADMIN_ID; |
| 1180 | |
| 1181 | /* If the auth type is steam, the id could be in a number of formats. Unify it. */ |
| 1182 | char steamIdent[16]; |
| 1183 | if (strcmp(auth, "steam") == 0) |
| 1184 | { |
| 1185 | if (!GetUnifiedSteamIdentity(identity, steamIdent, sizeof(steamIdent))) |
| 1186 | return INVALID_ADMIN_ID; |
| 1187 | |
| 1188 | identity = steamIdent; |
| 1189 | } |
| 1190 | |
| 1191 | AdminId id; |
| 1192 | if (!method->identities.retrieve(identity, &id)) |
| 1193 | return INVALID_ADMIN_ID; |
| 1194 | return id; |
| 1195 | } |
| 1196 | |
| 1197 | void AdminCache::SetAdminFlag(AdminId id, AdminFlag flag, bool enabled) |
| 1198 | { |
no test coverage detected