Changeset 178


Ignore:
Timestamp:
12/02/11 13:19:15 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Security review (See #30)

  • fix up ACL handling in group modification; as with user editing, the user may not make any change that includes access that user does not already have. This may mean removing a permission previously set but which the user doesn't have.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r177 r178  
    754754    $session->clear('resultmsg');
    755755  }
     756  if ($session->param('warnmsg')) {
     757    $page->param(warnmsg => $session->param('warnmsg'));
     758    $session->clear('warnmsg');
     759  }
    756760  if ($session->param('errmsg')) {
    757761    $page->param(errmsg => $session->param('errmsg'));
     
    841845    getPermissions($dbh, 'group', $webvar{gid}, \%curperms);
    842846    my %chperms;
     847    my $alterperms = 0;
    843848    foreach (@permtypes) {
    844849      $webvar{$_} = 0 if !defined($webvar{$_});
    845850      $webvar{$_} = 1 if $webvar{$_} eq 'on';
    846       $chperms{$_} = $webvar{$_} if $curperms{$_} ne $webvar{$_};
     851      if ($permissions{admin} || $permissions{$_}) {
     852        $chperms{$_} = $webvar{$_} if $curperms{$_} ne $webvar{$_};
     853      } else {
     854        $alterperms = 1;
     855        $chperms{$_} = 0;
     856      }
    847857    }
    848858    my ($code,$msg) = changePermissions($dbh, 'group', $webvar{gid}, \%chperms);
     
    850860      logaction(0, $session->param("username"), $webvar{gid},
    851861        "Updated default permissions in group $webvar{gid} (".groupName($dbh, $webvar{gid}).")");
    852       changepage(page => "grpman", resultmsg =>
    853         "Updated default permissions in group ".groupName($dbh, $webvar{gid}));
     862      if ($alterperms) {
     863        changepage(page => "grpman", warnmsg =>
     864                "You can only grant permissions you hold.  Default permissions in group ".
     865                groupName($dbh, $webvar{gid})." updated with reduced access");
     866      } else {
     867        changepage(page => "grpman", resultmsg =>
     868                "Updated default permissions in group ".groupName($dbh, $webvar{gid}));
     869      }
    854870    }
    855871    # no point in doing extra work
  • trunk/templates/grpman.tmpl

    r147 r178  
    88<div class="result"><TMPL_VAR NAME=resultmsg></div>
    99</TMPL_IF>
     10<TMPL_IF warnmsg>
     11<div class="warning">Warning: <TMPL_VAR NAME=warnmsg></div>
     12</TMPL_IF>
    1013<TMPL_IF errmsg>
    11 <div class='errmsg'><TMPL_VAR NAME=errmsg></div>
     14<div class="errmsg"><TMPL_VAR NAME=errmsg></div>
    1215</TMPL_IF>
    1316
Note: See TracChangeset for help on using the changeset viewer.