00946: CondAuth() enables publish authorization level?

Summary: CondAuth() enables publish authorization level?
Created: 2007-07-01 20:41
Status: Closed (Answered)
Category: Documentation
From: HaganFox
Assigned:
Priority: 44
Version: 2.2.0-beta57
OS:

Description: In PmWiki 2.2.0-beta57 with $EnableDrafts enabled, using the CondAuth() function to test for edit authorization disallows publishing. Put another way, the second line here

   $EnableDrafts = 1;
   if (! CondAuth($pagename, 'edit')) { /* comment */ }

seems to have the unintended effect of

   $EnablePublishAttr = 1;

A workaround to re-enable the publish button might be to add

$DefaultPasswords['publish'] = $DefaultPasswords['edit'];

or possibly

$DefaultPasswords['publish'] = '';

If CondAuth() is called too early, it is not aware of "Drafts". You could fix this by including drafts before calling CondAuth()

   $EnableDrafts = 1;
   $DefaultPasswords['publish'] = crypt('secret');
   include_once("$FarmD/scripts/draft.php");
   if (! CondAuth($pagename, 'edit')) { /* whatever */ }

Hope that helps. We should add this info to the Documentation. (Done.) --Petko