Closed Bug 683025 Opened 13 years ago Closed 13 years ago

Add a check_for_edit to Bugzilla::Bug to return the bug object if the user can edit the bug

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: rowebb, Assigned: rowebb)

Details

Attachments

(1 file, 2 obsolete files)

There should be a check_for_edit method in Bugzilla::Bug that will run check and take that bug and run can_edit_product. This will either throw a user error if they do not have permissions to edit the bug or will return the created bug object.
IMO, this doesn't make sense. It should be a User object method, like $user->can_edit_bug($bug)
No, it's: my $bug = Bugzilla::Bug->check_for_edit($id);
Attachment #556967 - Flags: review?(mkanat)
Comment on attachment 556967 [details] [diff] [review] Adding check_for_edit to Bugzilla::Bug Review of attachment 556967 [details] [diff] [review]: ----------------------------------------------------------------- Looks good on the implementation, but in order for us to accept patches, we require that the code actually be used somewhere. So just convert all the places where we call check() and then can_edit_product into a call to this.
Attachment #556967 - Flags: review?(mkanat) → review-
Updated the changes and patched all of the places where User->can_edit_product is called after Bug->check.
Attachment #556967 - Attachment is obsolete: true
Attachment #557026 - Flags: review?(mkanat)
Comment on attachment 557026 [details] [diff] [review] Adding check_for_edit to Bugzilla::Bug change v2 Review of attachment 557026 [details] [diff] [review]: ----------------------------------------------------------------- Beautiful! This is a very nice cleanup. :-)
Attachment #557026 - Flags: review?(mkanat) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 5.0
Comment on attachment 557026 [details] [diff] [review] Adding check_for_edit to Bugzilla::Bug change v2 >=== modified file 'Bugzilla/Bug.pm' >+ Bugzilla->user->can_edit_product($bug->{product_id}) Nit: should be ->product_id instead of ->{product_id}
Status: NEW → ASSIGNED
Updating the diff for the nit pick.
Attachment #557026 - Attachment is obsolete: true
Attachment #557331 - Flags: review+
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified process_bug.cgi modified Bugzilla/Bug.pm modified Bugzilla/BugUrl/Bugzilla/Local.pm modified Bugzilla/WebService/Bug.pm Committed revision 7949.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: