Ok, I take that back, it works fine. Sorry.
Note though; the value of, for example, $session_rights (which you set to $rights) won´t change by just assigning a new value to $rights late on. You´ll have to set $session_rights = $rights every time that the $rights variable changes.
To assign your session variables to other variables; put an ampersand (&) before it, like this:
$session_rights = &$rights;
And viola, when the $rights get a new value later on in the script - the $session_rights will follow.
/Niclas