UnrealScript library and basis for all Acedia Framework mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

99 lines
3.5 KiB

/**
* Config object for `Users_Feature`.
* Copyright 2022 Anton Tarasenko
*------------------------------------------------------------------------------
* This file is part of Acedia.
*
* Acedia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License, or
* (at your option) any later version.
*
* Acedia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/
class Users extends FeatureConfig
perobjectconfig
config(AcediaUsers);
var public config bool usePersistentData;
var public config string persistentDataDatabaseLink;
var public config bool useDatabaseForGroupsData;
var public config string groupsDatabaseLink;
var public config array<string> localUserGroup;
protected function HashTable ToData()
{
local int i;
local HashTable data;
local ArrayList userGroupList;
data = __().collections.EmptyHashTable();
data.SetBool(P("usePersistentData"), usePersistentData);
data.SetString(P("persistentDataDatabaseLink"), persistentDataDatabaseLink);
data.SetBool(P("useDatabaseForGroupsData"), useDatabaseForGroupsData);
data.SetString(P("groupsDatabaseLink"), groupsDatabaseLink);
userGroupList = _.collections.EmptyArrayList();
for (i = 0; i < localUserGroup.length; i += 1) {
userGroupList.AddString(localUserGroup[i]);
}
data.SetItem(P("userGroups"), userGroupList);
userGroupList.FreeSelf();
return data;
}
protected function FromData(HashTable source)
{
local int i;
local ArrayList userGroupList;
if (source == none) {
return;
}
usePersistentData = source.GetBool(P("usePersistentData"));
persistentDataDatabaseLink = source.GetString(
P("persistentDataDatabaseLink"),
"[local]database:/persistent_data");
useDatabaseForGroupsData = source.GetBool(P("useDatabaseForGroupsData"));
groupsDatabaseLink = source.GetString(
P("groupsDatabaseLink"),
"[local]database:/groups_data");
userGroupList = source.GetArrayList(P("userGroups"));
localUserGroup.length = 0;
if (userGroupList == none) {
return;
}
for (i = 0; i < userGroupList.GetLength(); i += 1) {
localUserGroup[localUserGroup.length] = userGroupList.GetString(i);
}
userGroupList.FreeSelf();
}
protected function DefaultIt()
{
usePersistentData = false;
persistentDataDatabaseLink = "[local]database:/persistent_data";
useDatabaseForGroupsData = false;
groupsDatabaseLink = "[local]database:/groups_data";
localUserGroup.length = 0;
localUserGroup[0] = "admin";
localUserGroup[1] = "moderator";
localUserGroup[2] = "trusted";
}
defaultproperties
{
configName = "AcediaUsers"
usePersistentData = false
persistentDataDatabaseLink = "[local]database:/persistent_data"
useDatabaseForGroupsData = false
groupsDatabaseLink = "[local]database:/groups_data"
localUserGroup(0) = "admin"
localUserGroup(1) = "moderator"
localUserGroup(2) = "trusted"
}