django-cprofile-middleware icon indicating copy to clipboard operation
django-cprofile-middleware copied to clipboard

Add a settings to by the can method.

Open hobbestigrou opened this issue 6 years ago • 2 comments

I think it can be interesting to add a settings to bypass the can method. I think on the development mode it's not necessary to be staff to show the result of profiling. Maybe it can be interesting to add a settings to bypass the current condition.

hobbestigrou avatar Mar 20 '18 14:03 hobbestigrou

Yeah, I agree with you. I've heard that feedback from a few people now.

At least two possible solutions:

  1. Add a setting that's to the weight of: CPROFILE_MIDDLEWARE_REQUIRE_STAFF where the default value is True
  2. Allow users to pass a callable that takes the User object and returns whether or not they're allowed to see the middleware output.

I think I prefer (1) in this case. What do you think?

omarish avatar Mar 22 '18 14:03 omarish

I agree with you I prefer the first solution. It's more simple and is sufficient. I'm going to make the contribution soon as possible. Today or tomorrow.

hobbestigrou avatar Mar 22 '18 15:03 hobbestigrou