Index: modules/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user.module,v retrieving revision 1.578 diff -u -p -r1.578 user.module --- modules/user.module 2 Feb 2006 01:51:54 -0000 1.578 +++ modules/user.module 8 Feb 2006 18:34:09 -0000 @@ -1624,20 +1625,36 @@ function user_admin_perm($str_rids = NUL $form['permission'][] = array('#type' => 'markup', '#value' => t('%module module', array('%module' => $module))); asort($permissions); foreach ($permissions as $perm) { + $row_visible = FALSE; $options[$perm] = ''; - $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm)); foreach ($role_names as $rid => $name) { // Builds arrays for checked boxes for each role if (strstr($role_permissions[$rid], $perm)) { - $status[$rid][] = $perm; + if (user_access($perm)) { + $status[$rid][] = $perm; + $row_visible = TRUE; + } + else { + // submit would delete the permission without this + $form_fixed['checkboxes'][$rid][$perm] = array('#type' => 'value', '#value' => 1); + } + } + else { + // an empty markup form element + $form_fixed['checkboxes'][$rid][$perm] = array(); } } + if ($row_visible) { + $form['permission'][$perm] = array('#type' => 'markup', '#value' => t($perm)); + } } } } + // Have to build checkboxes here after checkbox arrays are built foreach ($role_names as $rid => $name) { $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid]); + $form['checkboxes'][$rid] = array_merge($form['checkboxes'][$rid], (array)$form_fixed['checkboxes'][$rid]); $form['role_names'][$rid] = array('#type' => 'markup', '#value' => l($name, 'admin/access/'. $rid), '#tree' => TRUE); } $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));