If a user A and a user B are both super user and the user A removes the super user permission of the user B, and the user B is logged in, while the user B session remain active, he can do anything on the system including recover his super user permission.
Update
Looking at the JUser::authorise
method, we can see something like this:
public function authorise($action, $assetname = null)
{
// Make sure we only check for core.admin once during the run.
if ($this->isRoot === null)
{
//check if the user is root
}
return $this->isRoot ? true : JAccess::check($this->id, $action, $assetname);
}
So, if the user get logged in as super user, the JUser
object in the session will have the isRoot
property as true and the authorise
method will always return true without check the current permission in database.
OBS: JFactory:getUser()
return the JUser
in session