|
|
|
@ -22,6 +22,11 @@ class UserAPI extends AcediaObject
|
|
|
|
|
|
|
|
|
|
var private config string userdataDBLink; |
|
|
|
|
|
|
|
|
|
// Active `Users_Feature`, remember it along with life version to avoid |
|
|
|
|
// taking up a reference |
|
|
|
|
var private int usersFeatureLifeVersion; |
|
|
|
|
var private Users_Feature usersFeature; |
|
|
|
|
|
|
|
|
|
// Database where user's data (persistent data and user groups) is stored |
|
|
|
|
var private Database persistentDatabase; |
|
|
|
|
|
|
|
|
@ -35,6 +40,23 @@ protected function Constructor()
|
|
|
|
|
SetupUserDataDatabase(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// DO NOT CALL MANUALLY |
|
|
|
|
public function _reloadFeature() |
|
|
|
|
{ |
|
|
|
|
if ( usersFeature != none |
|
|
|
|
&& usersFeature.GetLifeVersion() == usersFeatureLifeVersion) |
|
|
|
|
{ |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
usersFeature = none; |
|
|
|
|
} |
|
|
|
|
usersFeature = |
|
|
|
|
Users_Feature(class'Users_Feature'.static.GetEnabledInstance()); |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
usersFeatureLifeVersion = usersFeature.GetLifeVersion(); |
|
|
|
|
} |
|
|
|
|
_.memory.Free(usersFeature); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Loads persistent user database, specified by the AcediaCore's config and |
|
|
|
|
// creates a basic skeleton for storing its data |
|
|
|
|
private function SetupUserDataDatabase() |
|
|
|
@ -233,11 +255,12 @@ public final function User FetchByKey(int userKey)
|
|
|
|
|
/** |
|
|
|
|
* Returns names of all available groups that users can belong to. |
|
|
|
|
* |
|
|
|
|
* In case this feature is configured to load user groups from a database |
|
|
|
|
* (either local or remote), the returned value is a locally cached one. |
|
|
|
|
* This helps us avoid having to query database each time we want to check |
|
|
|
|
* something about user groups, but it also means we might have an outdated |
|
|
|
|
* information. |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), the returned value is |
|
|
|
|
* a locally cached one. This helps us avoid having to query database each time |
|
|
|
|
* we want to check something about user groups, but it also means we might |
|
|
|
|
* have an outdated information. |
|
|
|
|
* |
|
|
|
|
* @return Array with names of all available groups. |
|
|
|
|
* All array elements are guaranteed to be not-`none`, unique and in |
|
|
|
@ -245,22 +268,296 @@ public final function User FetchByKey(int userKey)
|
|
|
|
|
*/ |
|
|
|
|
public final function array<Text> GetAvailableGroups() |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<Text> result; |
|
|
|
|
local array<Text> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetAvailableGroups(); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetAvailableGroups(); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds a new user group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), the returned value is |
|
|
|
|
* a locally cached one. This helps us avoid having to query database each time |
|
|
|
|
* we want to check something about user groups, but it also means we might |
|
|
|
|
* have an outdated information. |
|
|
|
|
* Changes will always persist for the duration of the match, but writing |
|
|
|
|
* them into the (non-config) source might fail, leading to changes being reset |
|
|
|
|
* after the level switch. For non-database (config) sources changes will |
|
|
|
|
* always be saved. |
|
|
|
|
* |
|
|
|
|
* @param groupName Name of the group to add. Case-insensitive. |
|
|
|
|
* @return `true` if group was added and `false` otherwise (including if it |
|
|
|
|
* already existed). |
|
|
|
|
*/ |
|
|
|
|
public final function bool AddGroup(BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.AddGroup(groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes existing user group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), the returned value is |
|
|
|
|
* a locally cached one. This helps us avoid having to query database each time |
|
|
|
|
* we want to check something about user groups, but it also means we might |
|
|
|
|
* have an outdated information. |
|
|
|
|
* Changes will always persist for the duration of the match, but writing |
|
|
|
|
* them into the (non-config) source might fail, leading to changes being reset |
|
|
|
|
* after the level switch. For non-database (config) sources changes will |
|
|
|
|
* always be saved. |
|
|
|
|
* |
|
|
|
|
* @param groupName Name of the group to remove. Case-insensitive. |
|
|
|
|
* @return `true` if group was removed and `false` otherwise (including if it |
|
|
|
|
* didn't exist in the first place). |
|
|
|
|
*/ |
|
|
|
|
public final function bool RemoveGroup(BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.RemoveGroup(groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Checks whether group with specified name exists. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), the returned value is |
|
|
|
|
* a locally cached one. This helps us avoid having to query database each time |
|
|
|
|
* we want to check something about user groups, but it also means we might |
|
|
|
|
* have an outdated information. |
|
|
|
|
* |
|
|
|
|
* @param groupName Name of the group to check existence of. |
|
|
|
|
* Case-insensitive. |
|
|
|
|
* @return `true` if group exists and `false` otherwise. |
|
|
|
|
*/ |
|
|
|
|
public final function bool IsGroupExisting(BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.IsGroupExisting(groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds user with the given SteamID into the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param steamID SteamID of the user to add to the group. |
|
|
|
|
* @param groupName Name of the group to add user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was added to the group (including if her was already |
|
|
|
|
* added to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool AddSteamIDToGroup( |
|
|
|
|
BaseText steamID, |
|
|
|
|
BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.AddSteamIDToGroup(steamID, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds user with the given SteamID into the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param steamID SteamID of the user to add to the group. |
|
|
|
|
* @param groupName Name of the group to add user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was added to the group (including if her was already |
|
|
|
|
* added to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final /*unreal*/ function bool AddSteamIDToGroup_S( |
|
|
|
|
string steamID, |
|
|
|
|
string groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.AddSteamIDToGroup_S(steamID, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds user (given by the `UserID`) into the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param id `UserID` of the user to add to the group. |
|
|
|
|
* @param groupName Name of the group to add user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was added to the group (including if her was already |
|
|
|
|
* added to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool AddUserIDToGroup( |
|
|
|
|
UserID id, |
|
|
|
|
BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.AddUserIDToGroup(id, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds given user into the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param user User to add to the group. |
|
|
|
|
* @param groupName Name of the group to add user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was added to the group (including if her was already |
|
|
|
|
* added to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool AddUserToGroup(User user, BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.AddUserToGroup(user, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes user with the given SteamID from the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param steamID SteamID of the user to remove to the group. |
|
|
|
|
* @param groupName Name of the group to remove user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was removed to the group (including if her was |
|
|
|
|
* already removed to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool RemoveSteamIDFromGroup( |
|
|
|
|
BaseText steamID, |
|
|
|
|
BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.RemoveSteamIDFromGroup(steamID, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes user with the given SteamID from the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param steamID SteamID of the user to remove to the group. |
|
|
|
|
* @param groupName Name of the group to remove user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was removed to the group (including if her was |
|
|
|
|
* already removed to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final /*unreal*/ function bool RemoveSteamIDFromGroup_S( |
|
|
|
|
string steamID, |
|
|
|
|
string groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.RemoveSteamIDFromGroup_S(steamID, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes user (given by the `UserID`) from the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param id `UserID` of the user to remove to the group. |
|
|
|
|
* @param groupName Name of the group to remove user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was removed to the group (including if her was |
|
|
|
|
* already removed to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool RemoveUserIDFromGroup( |
|
|
|
|
UserID id, |
|
|
|
|
BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.RemoveUserIDFromGroup(id, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes user from the specified group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is configured to load user |
|
|
|
|
* groups from a database (either local or remote), changes are guaranteed to |
|
|
|
|
* be made to the locally cached copy that will persist for the duration of |
|
|
|
|
* the game. Method will also attempt to change the database value, but that is |
|
|
|
|
* not guaranteed to succeed, meaning that changes might not be saved for |
|
|
|
|
* later matches. |
|
|
|
|
* |
|
|
|
|
* @param user User to remove to the group. |
|
|
|
|
* @param groupName Name of the group to remove user to. Case-insensitive. |
|
|
|
|
* @return `true` if user was removed to the group (including if her was |
|
|
|
|
* already removed to it) and `false` in any other case. |
|
|
|
|
*/ |
|
|
|
|
public final function bool RemoveUserFromGroup(User user, BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.RemoveUserFromGroup(user, groupName); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns names of all groups available for the user given by the SteamID. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -280,22 +577,18 @@ public final function array<Text> GetAvailableGroups()
|
|
|
|
|
public final function array<Text> GetGroupsForSteamID( |
|
|
|
|
BaseText steamID) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<Text> result; |
|
|
|
|
local array<Text> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetGroupsForSteamID(steamID); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetGroupsForSteamID(steamID); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns names of all groups available for the user given by the SteamID. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -314,23 +607,19 @@ public final function array<Text> GetGroupsForSteamID(
|
|
|
|
|
public final /*unreal*/ function array<Text> GetGroupsForSteamID_S( |
|
|
|
|
string steamID) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<Text> result; |
|
|
|
|
local array<Text> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetGroupsForSteamID_S(steamID); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetGroupsForSteamID_S(steamID); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns names of all groups available for the user given by the `UserID`. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -347,22 +636,18 @@ public final /*unreal*/ function array<Text> GetGroupsForSteamID_S(
|
|
|
|
|
*/ |
|
|
|
|
public final function array<Text> GetGroupsForUserID(UserID id) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<Text> result; |
|
|
|
|
local array<Text> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetGroupsForUserID(id); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetGroupsForUserID(id); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns names of all groups available for the user. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -380,22 +665,18 @@ public final function array<Text> GetGroupsForUserID(UserID id)
|
|
|
|
|
*/ |
|
|
|
|
public final function array<Text> GetGroupsForUser(User user) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<Text> result; |
|
|
|
|
local array<Text> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetGroupsForUser(user); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetGroupsForUser(user); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns `UserID`s of all users that belong into the group named `groupName`. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -410,23 +691,19 @@ public final function array<Text> GetGroupsForUser(User user)
|
|
|
|
|
*/ |
|
|
|
|
public final function array<UserID> GetGroupMembers(BaseText groupName) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local array<UserID> result; |
|
|
|
|
local array<UserID> emptyResult; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.GetGroupMembers(groupName); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.GetGroupMembers(groupName); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return emptyResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Checks whether user given by the `UserID` belongs to the group named |
|
|
|
|
* `groupName`. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -441,22 +718,16 @@ public final function array<UserID> GetGroupMembers(BaseText groupName)
|
|
|
|
|
*/ |
|
|
|
|
public final function bool IsUserIDInGroup(UserID id, Text groupName) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local bool result; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.IsUserIDInGroup(id, groupName); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.IsUserIDInGroup(id, groupName); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Checks whether user belongs to the given group. |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* In case active config of `Users_Feature` is set up to load user groups |
|
|
|
|
* from a database (either local or remote), the returned value is a locally |
|
|
|
|
* cached one. This helps us avoid having to query database each time we want |
|
|
|
@ -472,23 +743,17 @@ public final function bool IsUserIDInGroup(UserID id, Text groupName)
|
|
|
|
|
*/ |
|
|
|
|
public final function bool IsUserInGroup(User user, Text groupName) |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local bool result; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.IsUserInGroup(user, groupName); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.IsUserInGroup(user, groupName); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Checks whether user groups' data was already loaded from the source |
|
|
|
|
* (either config file or local/remote database). |
|
|
|
|
* |
|
|
|
|
* Will only work if `Users_Feature` is active. |
|
|
|
|
* 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. |
|
|
|
@ -497,17 +762,10 @@ public final function bool IsUserInGroup(User user, Text groupName)
|
|
|
|
|
*/ |
|
|
|
|
public final function bool IsUserGroupDataLoaded() |
|
|
|
|
{ |
|
|
|
|
local Users_Feature usersFeature; |
|
|
|
|
local bool result; |
|
|
|
|
|
|
|
|
|
usersFeature = Users_Feature(class'Users_Feature'.static |
|
|
|
|
.GetEnabledInstance()); |
|
|
|
|
if (usersFeature == none) { |
|
|
|
|
return result; |
|
|
|
|
if (usersFeature != none) { |
|
|
|
|
return usersFeature.IsUserGroupDataLoaded(); |
|
|
|
|
} |
|
|
|
|
result = usersFeature.IsUserGroupDataLoaded(); |
|
|
|
|
usersFeature.FreeSelf(); |
|
|
|
|
return result; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
defaultproperties |
|
|
|
|