Edit-Restricted Profile

Summary: Authors can only edit their own pages in the Profiles group.
Version: 2007-07-24
Prerequisites:
Status:
Maintainer:
Categories: Administration

Description

Authors can only edit their own pages in the Profiles group if you place the following code in local/Profiles.php

<?php if (!defined('PmWiki')) exit();
## Author's name must match the page name in order to edit.
if ($action == 'edit' && ! CondAuth(@$pagename, 'admin')) {
  @include_once($FarmD.'/scripts/author.php');
  if ($Author && $Author != @PageVar($pagename, '$Name')) {
    $action='login'; }
}
Drawbacks:
  • There's potentially confusing feedback when someone tries to edit a page and
  • (:if auth edit:) is true on every Profiles page unless an author sets a password on the page.

A possible improvement would be to replace

$action='browse'; }

with

redirect($AuthorGroup.'.EditAccessDenied'); }

and create a Profiles.EditAccessDenied page (or a page with a better name) with a message explaining what has happened.

Notes

This solution was first posted in PITS:00538

Release Notes

See Also

Contributors

Comments

See discussion at Edit-RestrictedProfile-Talk

User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.