Changeset 188


Ignore:
Timestamp:
12/06/11 16:40:04 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

UI tweaks and fixes for user and domain status changes:

  • Log all changes
  • Display "ok, did something" message
  • Check correct permission on domain status change
  • Check for permissions on user status change
  • Clean up URL that's handed around to put into template slots
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r187 r188  
    289289      $flag = 1 if isParent($dbh, $_, 'group', $webvar{id}, 'domain');
    290290    }
    291     if ($flag && ($permissions{admin} || $permissions{edit_domain})) {
     291    if ($flag && ($permissions{admin} || $permissions{domain_edit})) {
    292292      my $stat = domStatus($dbh,$webvar{id},$webvar{domstatus});
     293##fixme  switch to more consise "Enabled <domain"/"Disabled <domain>" as with users?
    293294      logaction($webvar{id}, $session->param("username"), parentID($webvar{id}, 'dom', 'group'),
    294295        "Changed ".domainName($dbh, $webvar{id})." state to ".($stat ? 'active' : 'inactive'));
     296      $page->param(resultmsg => "Changed ".domainName($dbh, $webvar{id})." state to ".
     297        ($stat ? 'active' : 'inactive'));
    295298    } else {
    296299      $page->param(errmsg => "You are not permitted to view or change the requested domain");
    297300    }
     301    $uri_self =~ s/\&amp;domstatus=[^&]*//g;    # clean up URL for stuffing into templates
    298302  }
    299303
     
    10691073      $flag = 1 if isParent($dbh, $_, 'group', $webvar{id}, 'user');
    10701074    }
    1071     if ($flag) {
    1072       userStatus($dbh,$webvar{id},$webvar{userstatus});
     1075    if ($flag && ($permissions{admin} || $permissions{user_edit})) {
     1076      my $stat = userStatus($dbh,$webvar{id},$webvar{userstatus});
     1077      logaction(0, $session->param("username"), parentID($webvar{id}, 'user', 'group'),
     1078        ($stat ? 'Enabled' : 'Disabled')." ".userFullName($dbh, $webvar{id}, '%u'));
     1079      $page->param(resultmsg => ($stat ? 'Enabled' : 'Disabled')." ".userFullName($dbh, $webvar{id}, '%u'));
    10731080    } else {
    10741081      $page->param(errmsg => "You are not permitted to view or change the requested user");
    10751082    }
     1083    $uri_self =~ s/\&amp;userstatus=[^&]*//g;   # clean up URL for stuffing into templates
    10761084  }
    10771085
Note: See TracChangeset for help on using the changeset viewer.