Extension:WhiteList/Theory of Operation

'''Note: This theory of operation does reflect the current version of Extension:WhiteList; it is intended to document an upcoming future release. See Future Development for more information. --Msul01 02:45, 13 November 2008 (UTC)'''

User Rights and Groups
Extension:WhiteList adds two new user rights:
 * editwhitelist
 * User has permission to modify the whitelists of existing users using a new special page called Special:WhitelistEdit (see screenshot in User's Guide).


 * restricttowhitelist
 * User is only allowed to view and edit pages as defined by the user-specific whitelist. All other pages are blocked. All restricted users will have a new Personal Tab called My Pages which will list only the pages they have access to. Restricted users may also request access to additional pages using this tab. (Such requests will generate an e-mail to the user's Manager.)

Extension:Whitelist adds two default groups which use these permissions. The Manager group has the editwhitelist user right. The Restricted group has the restricttowhitelist user right. Users with the userrights permission (assigned to the bureaucrat group by default) can assign users to these groups using Special:Userrights on their local MediaWiki installation.

Classes

 * WhiteList - methods that operate on wiki_whitelist table
 * WhiteListCache - methods that operate on wiki_whitelist_cache table
 * WhiteListHooks - methods called by hooks
 * WhiteListMyPages - Restricted user page methods
 * WhiteListAccessEditor - Manager interface (access editor) methods

WhiteList::EntryAdd

 * 1) Add entry to wiki_whitelist
 * 2) Call WhiteListCache::EntryAdd.

WhiteList::EntryUpdate
'''Note that the whitelist entry cannot be changed, so it is not necessary to update the cache on an entry update. (What about updating action?)'''
 * 1) Update wiki_whitelist entry.

WhiteList::EntryRemove

 * 1) Call WhiteListCache::WhitelistEntryRemove
 * 2) Remove entry from wiki_whitelist.

WhiteListCache::WhitelistEntryAdd
WhitelistEntryAdd($wl_id)
 * 1) Search for article titles that match the new whitelist entry.
 * 2) Add matches to whitelist_cache.

WhiteListCache::WhitelistEntryRemove
WhitelistEntryRemove($wl_id)
 * 1) Remove all whitelist_cache entries which match $wl_id

WhiteListCache::ArticleAdd
ArticleAdd($article)
 * 1) Scan all whitelist entries for titles which match the title of the newly created article.
 * 2) Add cache entries for each match.

WhiteListCache::ArticleRemove
ArticleRemove($article_id)
 * 1) Remove all whitelist_cache entries which match $article_id.

WhiteListCache::IsAllowed
IsAllowed(&$title, &$wgUser, $action, &$result) Check for matching whitelist entries. NOTE: Set wgUser to NULL for global whitelist/blacklist check.
 * 1) Query whitelist_cache database for user/action/title combination
 * 2) See if there are any matches which have expired
 * 3) If unexpired match is found, return true; otherwirse return false.

WhiteListCache::IsDenied
IsAllowed(&$title, &$wgUser, $action, &$result) Check for matching blacklist entries. NOTE: Set wgUser to NULL for global whitelist/blacklist check.
 * 1) TODO

WhiteListHooks::UserCan
$return = UserCan($title, $user, $action, $result) Check the article $title and $action against the $user's cached whitelist. Also check against global WhiteList and blacklists. May also need a check for edit access to own user page.

WhiteListHooks::ArticleInsertComplete
UserCan(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags, &$revision)

Call WhiteListCache::ArticleAdd.

WhiteListHooks::ArticleDeleteComplete
ArticleDeleteComplete(&$article, &$user, $reason, $id)</tt>

Call WhiteListCache::ArticleRemove.

WhiteListHooks::TitleMoveComplete
TitleMoveComplete(&$title, &$newtitle, &$user, $oldid, $newid)</tt>

Call WhiteListCache::ArticleRemove, then wfWhitelistCacheArticleAdd.

WhiteListHooks::PersonalUrlMyPagesAdd
PersonalUrlMyPagesAdd(&$personal_urls, $wgTitle)</tt> Add 'My Pages' personal URL for restricted users.

wiki_whitelist

 * K=Primary Key; I=Index

wiki_whitelist

 * K=Primary Key; I=Index

wiki_whitelist_cache

 * K=Primary Key; I=Index