[Home]UserCanEdit

UseModWiki | RecentChanges | Preferences

True if UserData has edit permissions.

 sub UserCanEdit {
  my ($id, $deepCheck) = @_;

   # Optimized for the "everyone can edit" case (don't check passwords)
   if (($id ne "") && (-f &GetLockedPageFile?($id))) {
     return 1  if (&UserIsAdmin());  # Requires more privledges
     # Later option for editor-level to edit these pages?
     return 0;
   }
   if (!$EditAllowed?) {
     return 1  if (&UserIsEditor());
     return 0;
   }
   if (-f "$DataDir/noedit") {
     return 1  if (&UserIsEditor());
     return 0;
   }
   if ($deepCheck) {   # Deeper but slower checks (not every page)
     return 1  if (&UserIsEditor());
     return 0  if (&UserIsBanned?());
   }
   return 1;
 }

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited February 14, 2008 4:00 pm by MarkusLude (diff)
Search: