/** * Check that current user is either the specified user or the superuser * * @param string $theUser * @throws exception if the user is neither the super user nor the user $theUser */ public static function checkUserIsSuperUserOrTheUser($theUser) { try { if (Core_Common::getCurrentUserLogin() !== $theUser) { // or to the super user Core_Common::checkUserIsSuperUser(); } } catch (Core_Access_NoAccessException $e) { throw new Core_Access_NoAccessException("The user has to be either the Super User or the user '{$theUser}' itself."); } }