Browse Source

Change `UserAPI` to make "all" user group contain all players

develop
Anton Tarasenko 1 year ago
parent
commit
a26b0adf05
  1. 55
      sources/Users/Users_Feature.uc

55
sources/Users/Users_Feature.uc

@ -70,16 +70,7 @@ var private LoggerAPI.Definition errDBContainsNonLowerRegister;
protected function OnEnabled()
{
local Commands_Feature feature;
_.users._reloadFeature();
feature =
Commands_Feature(class'Commands_Feature'.static.GetEnabledInstance());
if (feature != none)
{
feature.RegisterCommand(class'ACommandUserGroups');
feature.FreeSelf();
}
if (_server.IsAvailable()) {
LoadUserData();
SetupPersistentData(usePersistentData);
@ -96,9 +87,7 @@ protected function OnDisabled()
_.users._reloadFeature();
feature =
Commands_Feature(class'Commands_Feature'.static.GetEnabledInstance());
if (feature != none)
{
feature.RemoveCommand(class'ACommandUserGroups');
if (feature != none) {
feature.FreeSelf();
}
ResetUploadedUserGroups();
@ -590,9 +579,9 @@ public final function bool AddGroup(BaseText groupName)
local Text lowerCaseGroupName;
local HashTable emptyHashTable;
if (groupName == none) {
return false;
}
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return false;
lowerCaseGroupName = groupName.LowerCopy();
if (loadedGroupToUsersMap.HasKey(lowerCaseGroupName))
{
@ -676,9 +665,9 @@ public final function bool RemoveGroup(BaseText groupName)
local bool groupExists;
local Text lowerCaseGroupName;
if (groupName == none) {
return false;
}
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return false;
lowerCaseGroupName = groupName.LowerCopy();
groupExists = loadedGroupToUsersMap.HasKey(lowerCaseGroupName);
if (!groupExists)
@ -754,9 +743,9 @@ public final function bool IsGroupExisting(BaseText groupName)
local bool result;
local Text lowerCaseGroupName;
if (groupName == none) {
return false;
}
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return true;
lowerCaseGroupName = groupName.LowerCopy();
result = loadedGroupToUsersMap.HasKey(lowerCaseGroupName);
lowerCaseGroupName.FreeSelf();
@ -808,9 +797,10 @@ public final function bool AddSteamIDToGroup(
local Text lowercaseGroupName;
local HashTable groupUsers;
if (steamID == none) return false;
if (loadedGroupToUsersMap == none) return false;
if (groupName == none) return false;
if (steamID == none) return false;
if (loadedGroupToUsersMap == none) return false;
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return true;
lowercaseGroupName = groupName.LowerCopy();
groupUsers = loadedGroupToUsersMap.GetHashTable(lowercaseGroupName);
@ -998,9 +988,10 @@ public final function bool RemoveSteamIDFromGroup(
local Text lowercaseGroupName;
local HashTable groupUsers;
if (steamID == none) return false;
if (groupName == none) return false;
if (loadedGroupToUsersMap == none) return false;
if (steamID == none) return false;
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return false;
if (loadedGroupToUsersMap == none) return false;
lowercaseGroupName = groupName.LowerCopy();
groupUsers = loadedGroupToUsersMap.GetHashTable(lowercaseGroupName);
@ -1195,6 +1186,7 @@ public final function array<Text> GetGroupsForSteamID(BaseText steamID)
if (loadedGroupToUsersMap == none) return result;
if (steamID == none) return result;
result[0] = P("all").Copy();
immutableSteamID = steamID.LowerCopy();
iter = HashTableIterator(loadedGroupToUsersMap.Iterate());
while (!iter.HasFinished())
@ -1960,9 +1952,10 @@ public final function bool IsSteamIDInGroup(
local Text lowerGroupName;
local HashTable nextGroupUsers;
if (loadedGroupToUsersMap == none) return false;
if (groupName == none) return false;
if (steamID == none) return false;
if (loadedGroupToUsersMap == none) return false;
if (groupName == none) return false;
if (groupName.Compare(P("all"), SCASE_INSENSITIVE)) return true;
if (steamID == none) return false;
lowerGroupName = groupName.LowerCopy();
nextGroupUsers = loadedGroupToUsersMap.GetHashTable(lowerGroupName);
@ -2128,7 +2121,7 @@ public final /*unreal*/ function bool IsUserInGroup_S(
*
* Data loaded once is cached and this method returning `true` does not
* guarantee that is isn't outdated. Additional, asynchronous queries must be
* made to check for that.
* made to check for that.
*
* @return `true` if user groups' data was loaded and `false` otherwise.
*/

Loading…
Cancel
Save