Is there any reason why you work with pre-defined levels for page protection (default, block unregistered users, users with the sysop right), why not base the protection on the available groups available in the user_groups table?
cheers, Peter.
wikitech-l@lists.wikimedia.org