Closed Bug 306325 Opened 19 years ago Closed 19 years ago

Move CanEnterProduct() and CanEnterProductOrWarn() out of globals.pl

Categories

(Bugzilla :: Bugzilla-General, enhancement)

2.21
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file, 2 obsolete files)

These routines are user-specific and should go into User.pm; for instance:
$user->can_enter_product($product_name).
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 2.22
Also include GetEnterableProducts() as it depends on CanEnterProduct(). I will
wait for bug 286158 to be checked in before moving these routines.
Depends on: 306265
Attached patch patch, v1 (obsolete) — Splinter Review
Attachment #194970 - Flags: review?(bugreport)
Comment on attachment 194970 [details] [diff] [review]
patch, v1

The new can_enter_product ignores ENTRY from group_control_map.
Attachment #194970 - Flags: review?(bugreport) → review-
Attached patch patch, v2 (obsolete) — Splinter Review
Attachment #194970 - Attachment is obsolete: true
Attachment #197432 - Flags: review?(bugreport)
Comment on attachment 197432 [details] [diff] [review]
patch, v2

r=joel, but I want a 2xr on this and someone to run some serious QA tests on
it.
Attachment #197432 - Flags: review?(bugreport)
Attachment #197432 - Flags: review?
Attachment #197432 - Flags: review+
Comment on attachment 197432 [details] [diff] [review]
patch, v2

wicked or mkanat, could you have a look at it?
Attachment #197432 - Flags: review?(wicked)
Attachment #197432 - Flags: review?(mkanat)
Attachment #197432 - Flags: review?
Comment on attachment 197432 [details] [diff] [review]
patch, v2

I nominate wicked. :-)
Attachment #197432 - Flags: review?(mkanat)
Blocks: 311278
Comment on attachment 197432 [details] [diff] [review]
patch, v2

>Index: Bugzilla/User.pm
>===================================================================
>RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v
>+    if (!defined($product_name)) {
>+        return unless $warn;

Nit: I'd rather see this explicitly return 0 instead of undef/empty
list/nothing depending on context.

>+    if (!$has_access) {
>+        return unless $warn;

Nit: Ditto.

>+ Description: Returns 1 if the user can enter bugs into the specified product.
..
>+              - if $warn is false (or not given), a 'false' value is returned;

Nit: Please be consistent, either 0/1 or false/true but not mixed like this.
Probably best to use 0 and 1 everywhere.

>+ Params:      $product_name - a product name.
>+              $warn         - optional parameter, indicating whether an error
>+                              must be thrown if the user cannot enter bugs
>+                              into the specified product.

Nit: Document also what values are needed to trigger which behaviour of $warn.

>+ Returns:     1 if the user can enter bugs into the product,
>+              0 if the user cannot enter bugs into the product and if $warn
>+              is false (an error is thrown if $warn is true).

Nit: Can also return undef when user can't enter bugs into product because it
has no components.
Attachment #197432 - Flags: review?(wicked) → review+
Flags: approval?
Lpsolit:
  You'll need to make one further update to enter_bug.cgi that is not in your
current patch as a result of bug 311489.
Attached patch patch, v2.5Splinter Review
updated patch to take joel's patch into account (in enter_bug.cgi).
Attachment #197432 - Attachment is obsolete: true
Attachment #199082 - Flags: review?(bugreport)
Attachment #199082 - Flags: review?(bugreport) → review+
Flags: approval? → approval+
Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v <--  buglist.cgi
new revision: 1.313; previous revision: 1.312
done
Checking in describecomponents.cgi;
/cvsroot/mozilla/webtools/bugzilla/describecomponents.cgi,v
<--  describecomponents.cgi
new revision: 1.31; previous revision: 1.30
done
Checking in enter_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/enter_bug.cgi,v  <--  enter_bug.cgi
new revision: 1.122; previous revision: 1.121
done
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.342; previous revision: 1.341
done
Checking in post_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v  <--  post_bug.cgi
new revision: 1.127; previous revision: 1.126
done
Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.287; previous revision: 1.286
done
Checking in Bugzilla/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v  <--  Bug.pm
new revision: 1.97; previous revision: 1.96
done
Checking in Bugzilla/User.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v  <--  User.pm
new revision: 1.87; previous revision: 1.86
done
Checking in template/en/default/list/edit-multiple.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/list/edit-multiple.html.tmpl,v
 <--  edit-multiple.html.tmpl
new revision: 1.31; previous revision: 1.30
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: