Changeset 142 for trunk


Ignore:
Timestamp:
10/13/11 17:52:48 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Working on user-permission ACLs. Links now show or not as appropriate

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r140 r142  
    823823  }
    824824
     825  list_users();
     826
     827# Permissions!
     828  $page->param(adduser => $permissions{admin} || $permissions{user_create});
     829# should we block viewing other users?  Vega blocks "editing"...
     830#  NB:  no "edit self" link as with groups here.  maybe there should be?
     831#  $page->param(eduser => $permissions{admin} || $permissions{user_edit});
     832  $page->param(deluser => $permissions{admin} || $permissions{user_delete});
     833
     834  $page->param(errmsg => $webvar{errmsg}) if $webvar{errmsg};
    825835  $page->param(curpage => $webvar{page});
    826 
    827   list_users();
    828836
    829837} elsif ($webvar{page} eq 'user') {
     
    10701078      $page->param(errmsg => $msg);
    10711079      list_users($curgroup);
     1080#Error deleting user <TMPL_VAR NAME=delusername>: <TMPL_VAR NAME=errmsg>
    10721081    } else {
    10731082      # success.  go back to the user list, do not pass "GO"
     
    18401849    $row{bg} = ($rownum++)%2;
    18411850    $row{sid} = $sid;
     1851    $row{eduser} = ($permissions{admin} || $permissions{user_edit});
     1852    $row{deluser} = ($permissions{admin} || $permissions{user_delete});
    18421853    push @userlist, \%row;
    18431854  }
  • trunk/templates/useradmin.tmpl

    r139 r142  
    88<div class="warning">Warning: <TMPL_VAR NAME=warnmsg></div>
    99</TMPL_IF>
    10 <TMPL_IF del_failed>
    11 <div class='errmsg'>Error deleting user <TMPL_VAR NAME=delusername>: <TMPL_VAR NAME=errmsg></div>
     10<TMPL_IF errmsg>
     11<div class='errmsg'><TMPL_VAR NAME=errmsg></div>
    1212</TMPL_IF>
    1313
     
    2020</tr>
    2121<tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr>
     22<TMPL_IF adduser>
    2223<tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=user">New User</a></td></tr>
     24</TMPL_IF>
    2325</table>
    2426
     
    2729<TMPL_LOOP NAME=colheads>
    2830        <td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td></TMPL_LOOP>
    29         <td class="datahead_s">Delete</td>
     31<TMPL_IF deluser>       <td class="datahead_s">Delete</td></TMPL_IF>
    3032</tr>
    3133<TMPL_IF name=usertable>
    3234<TMPL_LOOP name=usertable>
    3335<tr class="row<TMPL_VAR name=bg>">
    34         <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=user&amp;action=edit&amp;user=<TMPL_VAR NAME=userid>"><TMPL_VAR NAME=username></a></td>
     36        <td align="left"><TMPL_IF eduser><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=user&amp;action=edit&amp;user=<TMPL_VAR NAME=userid>"><TMPL_VAR NAME=username></a><TMPL_ELSE><TMPL_VAR NAME=username></TMPL_IF></td>
    3537        <td class="data_nowrap"><TMPL_VAR name=userfull></td>
    3638        <td><TMPL_VAR name=usertype></td>
    3739        <td><TMPL_VAR name=usergroup></td>
    38         <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin<TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR NAME=offset></TMPL_IF>&amp;id=<TMPL_VAR NAME=userid>&amp;userstatus=<TMPL_IF NAME=active>useroff<TMPL_ELSE>useron</TMPL_IF>"><TMPL_IF NAME=active>enabled<TMPL_ELSE>disabled</TMPL_IF></a></td>
     40        <td align="center">
     41<TMPL_IF eduser>
     42                <a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin<TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR NAME=offset></TMPL_IF>&amp;id=<TMPL_VAR NAME=userid>&amp;userstatus=<TMPL_IF active>useroff<TMPL_ELSE>useron</TMPL_IF>"><TMPL_IF active>enabled<TMPL_ELSE>disabled</TMPL_IF></a>
     43<TMPL_ELSE>
     44                <TMPL_IF active>enabled<TMPL_ELSE>disabled</TMPL_IF>
     45</TMPL_IF>
     46</td>
     47<TMPL_IF deluser>
    3948        <td align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=deluser&amp;id=<TMPL_VAR NAME=userid>"><img src="images/trash2.png" alt="[ Delete ]" /></a></td>
     49</TMPL_IF>
    4050</tr>
    4151</TMPL_LOOP>
Note: See TracChangeset for help on using the changeset viewer.