Add hook to tweak the params after reading from file

RESOLVED INCOMPLETE

Status

()

Bugzilla
Extensions
--
enhancement
RESOLVED INCOMPLETE
8 years ago
8 years ago

People

(Reporter: gerv, Unassigned)

Tracking

Details

This is inspired by bug 473134, which wants a configurable attachment size limit by user class.

We should add a hook to the code which reads in the params, allowing you to modify the values dynamically. Of course, you wouldn't do so unconditionally - it would be easier just to change the param value. But you could have different values for different users. The above is just one case where that might be useful; others include letting some people resolve bugs with open blockers, or giving some people a different default query.

I anticipate this would be about five lines of code.

Gerv
mkanat: does this sound OK to you?

Gerv

Comment 2

8 years ago
  Ah, I'm not certain that it's the best idea. I think the case of a configurable attachment size limit by user class, for example, would be best dealt with by hooking the validators in Bugzilla::Attachment.
Max: you mean, replace the validator with a custom one (which optionally calls into the original one for some users) by monkeypatching the class? The validator does several things apart from checking the size, so that would require code copy and paste... Still, great to hear it's possible.

Gerv

Comment 4

8 years ago
(In reply to comment #3)
> Max: you mean, replace the validator with a custom one (which optionally calls
> into the original one for some users) by monkeypatching the class? The
> validator does several things apart from checking the size, so that would
> require code copy and paste... Still, great to hear it's possible.

  Actually you don't have to monkeypatch, there's an object_validators hook. But yeah, you would call the original one--I think there's already example code in the Example that does it.

Comment 5

8 years ago
(In reply to comment #3)
> that would require code copy and paste

  Also, maybe not--you could just do "local Bugzilla->params->{'some_value'} = 'blah'" before calling the original validator.
OK. Resolving this INCOMPLETE, in the sense that if we can come up with good use cases, it might be wanted, but at the moment there aren't any that people actually have given that the main one can be done another way.

Gerv
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.