Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 294715 Details for
Bug 406471
3.37: OR based group checking for bugs and product entry
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch containing all changes in one so far (v2)
or_groups.patch (text/plain), 13.71 KB, created by
David Lawrence
on 2008-02-13 00:43:04 UTC
(
hide
)
Description:
Patch containing all changes in one so far (v2)
Filename:
MIME Type:
Creator:
David Lawrence
Created:
2008-02-13 00:43:04 UTC
Size:
13.71 KB
patch
obsolete
>Index: Bugzilla/Search.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Search.pm,v >retrieving revision 1.6 >diff -u -r1.6 Search.pm >--- Bugzilla/Search.pm 4 Feb 2008 04:54:54 -0000 1.6 >+++ Bugzilla/Search.pm 13 Feb 2008 00:41:59 -0000 >@@ -780,14 +780,30 @@ > > if ($user->id) { > if (%{$user->groups}) { >- $query .= " AND bug_group_map.group_id NOT IN (" . join(',', values(%{$user->groups})) . ") "; >+ # REDHAT ENTENSION START 406471 >+ # OR based group checking >+ if ( Bugzilla->params->{'or_groups'} ) { >+ $query .= " LEFT JOIN user_group_map " . >+ " ON user_group_map.group_id = bug_group_map.group_id "; >+ # REDHAT ENTENSION END 406471 >+ } else { >+ $query .= " AND bug_group_map.group_id NOT IN (" . join(',', values(%{$user->groups})) . ") "; >+ } > } > > $query .= " LEFT JOIN cc ON cc.bug_id = bugs.bug_id AND cc.who = " . $user->id; > } > >- $query .= " WHERE " . join(' AND ', (@wherepart, @andlist)) . >+ # REDHAT ENTENSION START 406471 >+ # OR based group checking >+ if ( Bugzilla->params->{'or_groups'} ) { >+ $query .= " WHERE " . join(' AND ', (@wherepart, @andlist)) . >+ " AND bugs.creation_ts IS NOT NULL AND (((user_group_map.group_id IS NOT NULL) OR (bug_group_map.bug_id IS NULL))"; >+ # REDHAT ENTENSION END 406471 >+ } else { >+ $query .= " WHERE " . join(' AND ', (@wherepart, @andlist)) . > " AND bugs.creation_ts IS NOT NULL AND ((bug_group_map.group_id IS NULL)"; >+ } > > if ($user->id) { > my $userid = $user->id; >Index: Bugzilla/User.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/User.pm,v >retrieving revision 1.3 >diff -u -r1.3 User.pm >--- Bugzilla/User.pm 20 Jan 2008 16:38:25 -0000 1.3 >+++ Bugzilla/User.pm 13 Feb 2008 00:42:01 -0000 >@@ -563,13 +563,31 @@ > my ($self, $prod_id) = @_; > my $dbh = Bugzilla->dbh; > >- my $has_external_groups = >- $dbh->selectrow_array('SELECT 1 >+ # REDHAT EXTENSION START 406471 >+ my $has_external_groups; >+ # OR based group checking >+ if ( Bugzilla->params->{'or_groups'} ) { >+ my $or_group_check = >+ $dbh->selectrow_array('SELECT 1 >+ FROM group_control_map >+ LEFT JOIN user_group_map >+ ON group_control_map.group_id = user_group_map.group_id >+ AND product_id = ? >+ WHERE (group_control_map.group_id IS NULL ) >+ OR (canedit != 0 >+ AND user_group_map.group_id IS NOT NULL)', >+ undef, $prod_id); >+ $has_external_groups = !$or_group_check; >+ # REDHAT EXTENSION END 406471 >+ } else { >+ $has_external_groups = >+ $dbh->selectrow_array('SELECT 1 > FROM group_control_map > WHERE product_id = ? > AND canedit != 0 > AND group_id NOT IN(' . $self->groups_as_string . ')', > undef, $prod_id); >+ } > > return !$has_external_groups; > } >@@ -584,35 +602,54 @@ > # is cached because this may be called for every row in buglists or > # every bug in a dependency list. > unless ($sth) { >+ # REDHAT EXTENSION START 406471 >+ # Added ability to choose between AND or OR style group checking > $sth = $dbh->prepare("SELECT 1, reporter, assigned_to, qa_contact, > reporter_accessible, cclist_accessible, >- COUNT(cc.who), COUNT(bug_group_map.bug_id) >+ COUNT(cc.who), COUNT(bug_group_map.bug_id), >+ COUNT(user_group_map.group_id) > FROM bugs > LEFT JOIN cc > ON cc.bug_id = bugs.bug_id >- AND cc.who = $userid >+ AND cc.who = $userid > LEFT JOIN bug_group_map > ON bugs.bug_id = bug_group_map.bug_id >- AND bug_group_map.group_ID NOT IN(" . >- $self->groups_as_string . >- ") WHERE bugs.bug_id = ? >- AND creation_ts IS NOT NULL " . >- $dbh->sql_group_by('bugs.bug_id', 'reporter, ' . >- 'assigned_to, qa_contact, reporter_accessible, ' . >- 'cclist_accessible')); >+ LEFT JOIN user_group_map >+ ON user_group_map.group_id = bug_group_map.group_id >+ AND user_group_map.isbless = 0 >+ AND user_group_map.user_id = $userid >+ WHERE bugs.bug_id = ? >+ AND creation_ts IS NOT NULL " . >+ $dbh->sql_group_by('bugs.bug_id', 'reporter, ' . >+ 'assigned_to, qa_contact, reporter_accessible, ' . >+ 'cclist_accessible')); >+ # REDHAT EXTENSION END 406471 > } > $sth->execute($bugid); > my ($ready, $reporter, $owner, $qacontact, $reporter_access, $cclist_access, >- $isoncclist, $missinggroup) = $sth->fetchrow_array(); >+ $isoncclist, $bug_groups, $member_groups) = $sth->fetchrow_array(); > $sth->finish; > $self->{sthCanSeeBug} = $sth; >+ >+ # REDHAT EXTENSION START 406471 >+ # Added ability to choose between AND or OR style group checking >+ my $group_membership = 0; >+ if ( Bugzilla->params->{'or_groups'} ) { >+ $group_membership = 1 if $member_groups; >+ } >+ else { >+ $group_membership = 1 if $bug_groups == $member_groups; >+ } >+ # REDHAT EXTENSION END 406471 >+ # > return ($ready > && ((($reporter == $userid) && $reporter_access) > || (Bugzilla->params->{'useqacontact'} > && $qacontact && ($qacontact == $userid)) > || ($owner == $userid) > || ($isoncclist && $cclist_access) >- || (!$missinggroup))); >+ || ($bug_groups == 0) >+ || $group_membership)); > } > > sub can_see_product { >@@ -636,9 +673,19 @@ > } else { > $query .= " AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY; > } >- $query .= " AND group_id NOT IN(" . $self->groups_as_string . ") " . >- " WHERE group_id IS NULL " . >- "ORDER BY name"; >+ # REDHAT ENTENSION START 406471 >+ # OR based group checking >+ if ( Bugzilla->params->{'or_groups'} ) { >+ $query .= " LEFT JOIN user_group_map" . >+ " ON group_control_map.group_id = user_group_map.group_id" . >+ " WHERE user_group_map.group_id IS NOT NULL" . >+ " OR group_control_map.group_id IS NULL"; >+ } else { >+ $query .= " AND group_id NOT IN (" . $self->groups_as_string . ") " . >+ " WHERE group_id IS NULL "; >+ } >+ $query .= " ORDER BY name"; >+ # REDHAT ENTENSION END 406471 > > my $prod_ids = Bugzilla->dbh->selectcol_arrayref($query); > $self->{selectable_products} = Bugzilla::Product->new_from_list($prod_ids); >@@ -720,17 +767,24 @@ > if (defined $self->{enterable_products}) { > return $self->{enterable_products}; > } >- >- # All products which the user has "Entry" access to. >- my @enterable_ids =@{$dbh->selectcol_arrayref( >- 'SELECT products.id FROM products >- LEFT JOIN group_control_map >- ON group_control_map.product_id = products.id >- AND group_control_map.entry != 0 >- AND group_id NOT IN (' . $self->groups_as_string . ') >- WHERE group_id IS NULL >- AND products.disallownew = 0') || []}; >- >+ # REDHAT EXTENSION START 406471 >+ # add OR based group checking >+ my $query = "SELECT products.id FROM products" . >+ " LEFT JOIN group_control_map" . >+ " ON group_control_map.product_id = products.id" . >+ " AND group_control_map.entry != 0"; >+ if ( Bugzilla->params->{'or_groups'} ) { >+ $query .= " LEFT JOIN user_group_map" . >+ " ON group_control_map.group_id = user_group_map.group_id" . >+ " WHERE user_group_map.group_id IS NOT NULL" . >+ " OR group_control_map.group_id IS NULL" >+ } else { >+ $query .= " AND group_id NOT IN (" . $self->groups_as_string . ")" . >+ " WHERE group_id IS NULL" >+ } >+ $query .= " AND products.disallownew = 0"; >+ # REDHAT EXTENSION END 406471 >+ my @enterable_ids =@{$dbh->selectcol_arrayref($query) || []}; > if (@enterable_ids) { > # And all of these products must have at least one component > # and one version. >Index: Bugzilla/Config/GroupSecurity.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Config/GroupSecurity.pm,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 GroupSecurity.pm >--- Bugzilla/Config/GroupSecurity.pm 19 Nov 2007 22:11:21 -0000 1.1.1.1 >+++ Bugzilla/Config/GroupSecurity.pm 13 Feb 2008 00:42:01 -0000 >@@ -96,7 +96,16 @@ > name => 'strict_isolation', > type => 'b', > default => 0 >- } ); >+ }, >+# REDHAT EXTENSION START 406471 >+# This param can be set to 1 to enable OR-based groups checking >+ { >+ name => 'or_groups', >+ type => 'b', >+ default => 0 >+ } >+# REDHAT EXTENSION END 406471 >+ ); > return @param_list; > } > >Index: template/en/default/admin/params/groupsecurity.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/admin/params/groupsecurity.html.tmpl,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 groupsecurity.html.tmpl >--- template/en/default/admin/params/groupsecurity.html.tmpl 19 Nov 2007 22:11:21 -0000 1.1.1.1 >+++ template/en/default/admin/params/groupsecurity.html.tmpl 13 Feb 2008 00:42:01 -0000 >@@ -57,6 +57,14 @@ > "or make or remove dependencies " _ > "involving any bug that is in a product on which that " _ > "user is forbidden to edit.", >- >+ # REDHAT ENTENSION START #406471 >+ or_groups => "Allow OR-based groups checking. " _ >+ "If set to on, use OR based group checking. " _ >+ "If set to off, then use AND based group checking. " _ >+ "With OR group checking, a user would need to " _ >+ "be in one or more groups a bug is marked private to. " _ >+ "With AND group checking, a user would need to " _ >+ "be in all groups a bug is marked private to." >+ # REDHAT ENTENSION END #406471 > } > %] >Index: template/en/default/bug/edit.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/bug/edit.html.tmpl,v >retrieving revision 1.8 >diff -u -r1.8 edit.html.tmpl >--- template/en/default/bug/edit.html.tmpl 11 Feb 2008 03:20:40 -0000 1.8 >+++ template/en/default/bug/edit.html.tmpl 13 Feb 2008 00:42:02 -0000 >@@ -667,7 +667,7 @@ > [% IF NOT emitted_description %] > [% emitted_description = 1 %] > <div id="bz_restrict_group_visibility_help"> >- <b>Only users in all of the selected groups can view this [% terms.bug %]:</b> >+ <b>Only users in [% IF Param('or_groups') %]any[% ELSE %]all[% END %] of the selected groups can view this [% terms.bug %]:</b> > <br> > <font size="-1"> > (Unchecking all boxes makes this a more public [% terms.bug %].) >Index: template/en/default/bug/create/create.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/bug/create/create.html.tmpl,v >retrieving revision 1.3 >diff -u -r1.3 create.html.tmpl >--- template/en/default/bug/create/create.html.tmpl 4 Dec 2007 17:39:26 -0000 1.3 >+++ template/en/default/bug/create/create.html.tmpl 13 Feb 2008 00:42:02 -0000 >@@ -548,7 +548,7 @@ > <td colspan="3"> > <br> > <strong> >- Only users in all of the selected groups can view this [% terms.bug %]: >+ Only users in [% IF Param('or_groups') %]any[% ELSE %]all[% END %] of the selected groups can view this [% terms.bug %]: > </strong> > <br> > <font size="-1"> >Index: template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.11 >diff -u -r1.11 user-error.html.tmpl >--- template/en/default/global/user-error.html.tmpl 12 Feb 2008 04:33:05 -0000 1.11 >+++ template/en/default/global/user-error.html.tmpl 13 Feb 2008 00:42:04 -0000 >@@ -1232,11 +1232,11 @@ > Patches cannot be more than [% Param('maxpatchsize') %] KB in size. > Try breaking your patch into several pieces. > >- [% #REDHAT EXTENSION START 406141 %] >+ [%#REDHAT EXTENSION START 406141 %] > [% ELSIF error == "product_access_denied" %] > Either the product '[% product FILTER html %]' does not exist or > you don't have access to it. >- [% #REDHAT EXTENSION END 406141 %] >+ [%#REDHAT EXTENSION END 406141 %] > > [% ELSIF error == "product_doesnt_exist" %] > [% title = "Specified Product Does Not Exist" %]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dkl
: review? (
tfu
)
Actions:
View
|
Diff
Attachments on
bug 406471
:
293982
|
293983
|
293984
|
294053
|
294073
|
294075
|
294076
|
294190
|
294306
|
294480
|
294619
|
294629
|
294714
|
294715
|
294863
|
294968
|
298956