BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.4 support => Topic started by: Tichy on February 14, 2008, 12:19:06 pm
-
The 0.4 branch still has the problem to forget the admin rights from time to time , already discussed here:
-
Disappearing admin rights (http://bebot.link/index.php/topic,1129.0.html) - bot "forgetting" (http://bebot.link/index.php/topic,1022.0.html)
Is there any progress to solve this problem? There was the presumption this is trigged by a failing get_uid call in AOChat. I'd a short look at the code and wonder about one thing:
function get_access_level_player($player)
{ // Start function get_access_level()
// If user does not exist return ANONYMOUS access right away
$uid = $this -> bot -> aoc -> get_uid($player);
if (!$uid)
return 0;
$player = ucfirst(strtolower($player));
// Check #1: Check Owner and SuperAdmin from Bot.conf.
if ($player == $this -> owner)
return 256;
if (isset($this -> super_admin[$player]))
return 255;
// Check to see if the user is banned.
if (isset($this -> cache['banned'][$player]))
return -1;
// Check user's table status. users_table: anonymous (0), guest (1), member (2)
$highestlevel = 0;
if (isset($this -> cache['guests'][$player])
|| ($this -> bot -> settings -> get("Security", "GuestInChannel") && $this -> bot -> online -> in_chat($player)))
$highestlevel = 1;
if (isset($this -> cache['members'][$player]))
$highestlevel = 2;
// Check Org Rank Access.
if ($this -> bot -> guildbot && isset($this -> cache['members'][$player]))
{
$highestlevel = $this -> org_rank_access($player, $highestlevel);
}
// Check default and custom groups.
$highestlevel = $this -> group_access($player, $highestlevel);
// Check if the flexible security module is enabled, if yes check there:
if (isset($this -> bot -> flexible_security))
{
$highestlevel = $this -> bot -> flexible_security -> flexible_group_access($player, $highestlevel);
}
// !leader handling
if ($this -> bot -> settings -> exists("Leader", "Name") && $highestlevel < LEADER)
{
if ($this -> bot -> settings -> get("Leader", "Leaderaccess")
&& strtolower($player) == strtolower($this -> bot -> settings -> get("Leader", "Name")))
{
$highestlevel = LEADER;
}
}
// All checks done, return the result.
return $highestlevel;
} // End function get_access_level()
Why does BeBot resolve the UID here? I could not see any benefit from resolving (and not using) the UID... and if the lookup fails this would lead to the loosing-admin-rights-problem I would guess.
-
That line is there to prevent problems with further SQL queries for characters that don't exist. I think there aren't any problems with get_uid().
Which doesn't answer your real question. I don't know what is causing the bot to forget admin rights once in a while. My current guess is that it is caused somehow by roster updates, as the roster is the only core file where I am not using the release version, but a customized one for my setup. I think Ebag tried to rewrite the trunk version to solve the problem. Not sure if it still exists in the trunk version...
-
I'd added some debugging stuff to the get_uid function of AOChat. I have an org bot where my char is owner but not member of the org. I only get owner access if get_uid is alled with my nickname as parameter. But sometimes it is called with my aoid and I get no access.
I think the problem is that somewhere before the bot uses an aoid, but the AOChat library could not lookup names from aoid's. There is only a lookup cache from nickname->aoid lookups in AOChat which is used to do aoid->nickname lookups. I assume this is the point where the admin access is lost (looking up aoid instead of nicknames in the security module).