From private email from killes to me:
Hi Derek,
today, we've had to spiders wreak havoc on d.o. Among other pages they visited the statistics pages too often to be funny.
I am thinking that it doesn't make sense to offer this information to logged out users. We can request people to log in got this, especially since it is expensive to compute.
Can you point me to where the code for this is so I can craft a patch?
Cheers,
Gerhard
I replied:
contributions/modules/project_issue/includes/statistics.inc
And he replied:
Thanks!
While I can change the access permission for this through hook_menu_alter, the links to the pages can only be changed in the module or the theme as a last resort.
Would you be ok to change this in the project issue module itself?
If yes: which permission should I require for statistics access? I was thinking of simpy using user_is_logged_in.
Cheers,
Gerhard
Seems silly to continue this conversation in private, so I'm creating this issue to further discuss.
If it's going to be handled natively inside project_issue and not a d.o hack, I'd rather not assume that anonymous users can't see these pages. It should be trivial to just add a new "view issue statistics" in project_issue_perm() and use that for the menu access on the pages and in the spots in the UI where the links are being generated. Then sites that don't care can give this perm to anon + auth, whereas d.o can just give it to auth.
Should be a very easy + small patch, although if you really wanted to do this right, your patch would include simpletests to ensure the permission is doing what it's supposed to. :) Then a) I could commit + deploy more easily and b) we'd make sure not to break this in the future.
Thanks,
-Derek
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | permission-issue-stats-988188-10.patch | 9.54 KB | mr.baileys |
| #9 | 988188-missing-hunk.patch | 1.07 KB | damien tournoud |
| #2 | project-issue-statistics-permission.patch | 7.95 KB | mr.baileys |
Comments
Comment #1
mr.baileysTalked to killes on IRC and will take a stab at this later, so assigning to myself...
Comment #2
mr.baileysHere's a patch that introduces a new "access issue statistics" permission + accompanying tests.
Comment #3
gerhard killesreiter commentedThat looks good to me, but I hope dww can review it too.
Comment #4
miaoulafrite commentedthanks for this information.
in my case issue tracking is related to projects that are themselves related to clients
it would be nice to restrict access to project pages and the issues related to these projects so that customers cannot see what the other projects you run AND the issues you have on these projects.
what do you think?
Comment #5
dww@miaoulafrite: I think you're confusing this issue with a node access module that knows about projects. Luckily, such a project exists, and almost works:
http://drupal.org/project/project_access
@mr.baileys: Thanks for the patch! Sadly, I've been totally slammed deploying #11416: Please provide *.zip downloads. and working on the Git migration. We've got a major Git-related deadline this week, and I've got to get a ton of stuff done by then. So, hopefully next week I'll have more time to deal with issues like this. I've added a personal TODO item to resurface in my universe next week to look at this.
Thanks,
-Derek
Comment #6
miaoulafrite commented@dww: i was thinking of nodeaccess yes. i don't know this module very well but i believe it does not fit to project (which is probably the reason why project_access came up.
since project_access is not yet ready for distribution, what would you suggest to control access among projects?
Comment #7
dwwI'd suggest you open a separate support request instead of continuing to discuss your questions in an unrelated issue. ;)
Comment #8
damien tournoud commentedWe were seeing a lot of those post Git launch. I deployed this manually to bzr.
Comment #9
damien tournoud commentedThis hunk (project-specific issue lists) was missing from the patch.
Comment #10
mr.baileysSo this is already running on drupal.org? Cool :)
Re-rolled because patch no longer applied cleanly, also combining the patch from #2 with Damien's patch from #9.
Comment #11
dwwGreat, thanks! Reviewed, ran tests (all passing), tested myself, and committed/pushed:
http://drupal.org/commitlog/commit/1894/d9655bc547754e9de81e9bae99639b95...
Also pushed a follow-up to fix some code-style issues and re-worded the assertion text to make it much less verbose:
http://drupal.org/commitlog/commit/1894/198d2f31a7ee276969374f2c286128f0...
Thanks, everyone!
Comment #12
dwwNote: this is now deployed (again) for real from a clean vendor import.
Comment #13
dwwNote: when this was deployed, no one gave the "view issue statistics" permission to any roles. I was getting complaints, so I just checked with nnewton and he was okay with me granting this back to the "git user" role for all project maintainers to at least be able to access this. The main concern was anon + bots crawling these pages, IIRC.
In the future, this page needs to be totally re-done based on metrics from Sampler API, but that's another story entirely. ;)
Just documenting the change in permissions for posterity...
Comment #14
dwwWhoops, this broke the cache invalidation for the issue summary block on project pages:
#1077880-4: Block cache of issue counts on project pages is not invalidated when it should be