Closed (fixed)
Project:
Privatemsg
Version:
7.x-1.x-dev
Component:
Code (privatemsg_roles)
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2010 at 06:30 UTC
Updated:
8 May 2011 at 11:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
berdirMy plan was to allow to configure this with pm_block_user but I agree that doing this based on roles is easier.
Try the attached patch. Note that the existing "write privatemsg to roles" permission has been renamed to "write privatemsg to all roles" to make it clearer.
Comment #2
BenK commentedSubscribing to help with testing...
Comment #3
BenK commentedHey Berdir,
I tried the patch in #1 with a bunch of different permission combinations. Everything seems to be working great.
The only bug/issue I found dealt with the autocomplete: Currently, even if a user only has permission to send to one role, he is able to see all roles in the "To" autocomplete. So it seems we need to update the autocomplete for these more granular permissions.
Also, here are the messages that are currently displayed when a user tries to send to a role that he doesn't have permission to send to:
You must include at least one valid recipient.
The following users will not receive this private message: authenticated user [role]
But neither of these messages actually tells the user what the problem is... that he doesn't have permission for sending to that particular role. Perhaps we also include a message that says something like:
'You are not allowed to send messages to the authenticated user role.'
Thoughts?
--Ben
Comment #4
berdirFixed the problem with the autocomplete.
I think we already discussed the second point, the thing is that while I fully agree with you, that is currently hard to do. The access checking goes through several functions and the function that currently decides if he has access or not can simply return TRUE or FALSE.
Maybe we can try to handle that in a follow up, it hasn't directly to do with this feature, it's something that needs to be changed in privatemsg.module itself first. What I did in the patch however is slightly change the error message to speak of "recipients", not users.
Comment #5
berdir#4: privatemsg_permissions2.patch queued for re-testing.
Comment #6
berdirRe-rolled patch without the user/recipient changes, will open a new issue for that.
Comment #7
berdirNew patch.
Comment #8
berdirThird try.
Comment #9
BenK commentedBumping this to help with testing the latest patch.
Comment #10
berdirI've commited this last week...
Comment #11
berdirOk, here is a patch for Drupal 7. All tests should pass.
Note that this patch applies against 7.x-1.x but it will be the start of a new 7.x-2.x, together with many other features that were added to 6.x-2.x.
Comment #12
berdirCommitted
Powered by Dreditor (triage sandbox) and Triage transitions