[Pmwiki-users] Nested group permissions

Crisses crisses at kinhost.org
Wed Apr 30 10:29:46 CDT 2003

> That's it!  Let me know if you need any clarification on anything.

Ok:  it does not work right now:

For example: tried entering the NC17 edit password to read NC17, it asked
for a password.  Put in NC17 edit password to edit an NC17 page, it worked,
but I could not edit PG13, could not read NC17 (both asked for a password).
I entered the read PG13 password to read PG13, it worked.  Checked GRating
read access and this worked (this puzzled me, given everything else, maybe I
erred in encrypting a password?, so I'll check that). Then I tried XXX read
password to read XXX, it worked, then I tried to view a NC17 page, it asked
for a password.  I went back to try to read Grating, which just worked, and
it asked for a password, so it forgot that I just had access.

So something's not quite right.  Edit passwords are not granting read
access, or lower-level edit access.  Read passwords at upper levels are not
granting read access at lower levels (with the strange possible exception of
PG13 read having granted GRating read?).  I tested several times by
reloading a browser and using another browser (just so it would reset my
passwords), and had the same problems.  I went through and 'cleared' the
group passwords from the webbrowser using the admin password, also, in case
that was interfering.

This is what I put in the local.php file:

$DefaultPasswords['attr'] = '*'; # negates per-page passwords

## The following code is added by Crisses to create nested pswds
## Code supplied by PMichaud

    $grouplevels = array('GRating'=>1, 'PG13'=>2, 'NC17'=>3, 'XXX'=>4);
    $pwread['GRating'] = ('encryptedpassword');
    $pwedit['GRating'] = ('encryptedpassword');
    $pwread['PG13'] = ('encryptedpassword');
    $pwedit['PG13'] = ('encryptedpassword');
    $pwread['NC17'] = ('encryptedpassword');
    $pwedit['NC17'] = ('encryptedpassword');
    $pwread['XXX'] = ('encryptedpassword');
    $pwedit['XXX'] = ('encryptedpassword');

## Note that each of the $pw entries can be arrays if you want to
## distribute some multiple passwords.  Then, figure out what group
## we're in, and get the level for the current group:

    $group = FmtPageName('$Group',$pagename);
    $thislevel = $grouplevels[$group];

## Set up the $DefaultPasswords entries depending on
## the current group.  Basically, passwords in groups with equal or
## higher levels than the current one are added to the arrays:

    foreach ($grouplevels as $g=>$v) {
      if ($v>=$thislevel) {
        $DefaultPasswords['read'] =
        $DefaultPasswords['edit'] =

## allow all of the edit passwords to be accepted for read
## actions:

    $DefaultPasswords['read'] =

Thanks so much :)

"If English was good enough for Jesus, it should be good enough for you."
  -- proprietor of Christian bookstore

More information about the pmwiki-users mailing list