collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Loosing admin rights...  (Read 3353 times)

0 Members and 1 Guest are viewing this topic.

Offline Tichy

  • BeBot User
  • **
  • Posts: 42
  • Karma: +0/-0
Loosing admin rights...
« 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:


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:

Quote from: core/Security.php
    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.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Loosing admin rights...
« Reply #1 on: February 14, 2008, 06:52:56 pm »
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...

Offline Tichy

  • BeBot User
  • **
  • Posts: 42
  • Karma: +0/-0
Re: Loosing admin rights...
« Reply #2 on: February 15, 2008, 03:38:46 pm »
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).

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 435
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal