From b8b72d8470bebfd8aa721c268ce904603f1b1b82 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 18 Apr 2012 16:50:58 +1200 Subject: [PATCH] Fix bug in "Edit" of existing grant. --- inc/ui/principal-edit.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/inc/ui/principal-edit.php b/inc/ui/principal-edit.php index bbb71bbe..7efe5350 100644 --- a/inc/ui/principal-edit.php +++ b/inc/ui/principal-edit.php @@ -371,7 +371,7 @@ EOTEMPLATE; function build_privileges_html( $ed, $fname ) { global $privilege_xlate, $privilege_names; - + $btn_all = htmlspecialchars(translate('All')); $btn_all_title = htmlspecialchars(translate('Toggle all privileges')); $btn_rw = htmlspecialchars(translate('Read/Write')); $btn_rw_title = htmlspecialchars(translate('Set read+write privileges')); $btn_read = htmlspecialchars(translate('Read')); $btn_read_title = htmlspecialchars(translate('Set read privileges')); @@ -611,14 +611,17 @@ function grant_row_editor() { function edit_grant_row( $row_data ) { global $id, $grantrow; - - if ( $row_data->to_principal > -1 ) { - $grantrow->Initialise( $row_data ); + + $orig_to_id = intval($row_data->to_principal); + if ( $orig_to_id > -1 ) { + $grantrow->SetRecord( $row_data ); } - + else { + $grantrow->Initialise( $row_data ); + } + $privs_html = build_privileges_html( $grantrow, 'grant_privileges' ); - $orig_to_id = $row_data->to_principal; $form_id = $grantrow->Id(); $form_url = preg_replace( '#&(edit|delete)_grant=\d+#', '', $_SERVER['REQUEST_URI'] );