Hi Berdir

thanks for submodule for sending messages to some role, it works nice.

I have a feature request - it would be nice if there could be permission for exh user role, so than i can set that all users with role "smnall admin" can set messages to role "small admin" e.g. and all users with role "big admin" can send messages to role "authenticated user".
Currently i am missing this granularity.

thanks
Igor

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new9.86 KB

My 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.

BenK’s picture

Subscribing to help with testing...

BenK’s picture

Status: Needs review » Needs work

Hey 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

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new13.21 KB

Fixed 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.

berdir’s picture

#4: privatemsg_permissions2.patch queued for re-testing.

berdir’s picture

Version: » 6.x-2.x-dev
StatusFileSize
new10.48 KB

Re-rolled patch without the user/recipient changes, will open a new issue for that.

berdir’s picture

StatusFileSize
new10.51 KB

New patch.

berdir’s picture

StatusFileSize
new10.62 KB

Third try.

BenK’s picture

Bumping this to help with testing the latest patch.

berdir’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

I've commited this last week...

berdir’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new11 KB

Ok, 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.

berdir’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.