Browse Source

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

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

35
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();
@ -811,6 +800,7 @@ public final function bool AddSteamIDToGroup(
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);
@ -1000,6 +990,7 @@ public final function bool RemoveSteamIDFromGroup(
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();
@ -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())
@ -1962,6 +1954,7 @@ public final function bool IsSteamIDInGroup(
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();

Loading…
Cancel
Save