From ae1599c4834d90007e099da65262c77e78adf9e4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 24 Nov 2005 01:56:52 +0000 Subject: [PATCH] r572: Added field permissions to field.php itself --- admin/field.php | 42 ++++++++++++++++++++++++++++++++++++++++++ docs/beta-3-review.txt | 2 -- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/admin/field.php b/admin/field.php index 532cf0d..1eaf7c0 100644 --- a/admin/field.php +++ b/admin/field.php @@ -151,7 +151,21 @@ if ($_REQUEST['do'] == 'update') $extraupdate WHERE fieldid = " . intval($bugsys->in['fieldid']) ); + + $fieldid = intval($bugsys->in['fieldid']); } + + foreach ($bugsys->in['custom'] AS $usergroupid => $mask) + { + $values[] = intval($usergroupid) . ", $fieldid, " . intval($mask); + } + + $db->query(" + REPLACE INTO " . TABLE_PREFIX . "bugfieldpermission + (usergroupid, fieldid, mask) + VALUES + (" . implode("),\n\t\t\t(", $values) . ")" + ); $admin->redirect('field.php?do=modify', ($add ? $lang->string('The custom field has been added') : $lang->string('The custom field has been updated'))); } @@ -247,7 +261,35 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') break; } + $admin->table_end(); + + // custom field permissions + $admin->table_start(); + $admin->table_head($lang->string('Custom Field Permissions')); + + if ($edit) + { + $perms = $db->query("SELECT usergroupid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = $field[fieldid]"); + while ($perm = $db->fetch_array($perms)) + { + $permissions["$perm[usergroupid]"] = $perm['mask']; + } + } + + $usergroups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid"); + while ($usergroup = $db->fetch_array($usergroups)) + { + unset($listitem); + $admin->list_item($lang->string('No Permission'), 0, $permissions["$usergroup[usergroupid]"] == 0); + $admin->list_item($lang->string('Can View Field'), 1, $permissions["$usergroup[usergroupid]"] == 1); + $admin->list_item($lang->string('Can View, Edit Field'), 2, $permissions["$usergroup[usergroupid]"] == 2); + $admin->row_list($usergroup['title'], "custom[$usergroup[usergroupid]]"); + } + + $admin->table_end(); + // end table + $admin->table_start(); $admin->row_submit((($edit) ? '[' . $lang->string('Delete Field') . ']' : '')); $admin->table_end(); $admin->form_end(); diff --git a/docs/beta-3-review.txt b/docs/beta-3-review.txt index b2f521c..4926e69 100644 --- a/docs/beta-3-review.txt +++ b/docs/beta-3-review.txt @@ -6,8 +6,6 @@ - I can guess 'auto action' = workflow setup; but the new screen is not really very helpful -- unintuitive that I have to add perms to the new field; could they default to the page settings? Could you ask me that when I create the new field? - - commit changes layout on bug display not visible - different color? - search didn't work; I set new in my kewyord field; nothing happens -- 2.43.5