PmWiki / CondAuth

Check whether the user requesting a page has specific authorizations, for example editing, browsing.

if (CondAuth($pagename, 'edit')) { ... }

You can provide either authorization levels ('read', 'edit', 'attr', 'admin') or action names ('browse', 'upload', 'source') as the second argument to CondAuth().

When using CondAuth() or other similar functions it's important to remember to place them as late as possible in your config.php to avoid various caching issues which can be very difficult to troubleshoot otherwise. CondAuth causes the cache(s) to be populated, which may cause problems by code further down expecting unpopulated caches.

See also:

  • Functions - How some of the functions in pmwiki.php work


This page may have a more recent version on pmwiki.org: PmWiki:CondAuth, and a talk page: PmWiki:CondAuth-Talk.