Hi,

Id like to use PM in our site, but we need centralized Inbox.

Ive created my own PM admin module, which does this perfectly, the only issue I am having is the following line in the functon privatemsg_thread_load.

if (empty($thread['participants']) && privatemsg_user_access('read all private messages', $account)) {

Do you think you could create a way to allow other module to alter the permissions?

Something like:

if (empty($thread['participants']) && (privatemsg_user_access('read all private messages', $account) || privatemsg_user_access_alter($account))) {

Then in privatemsg_user_access_alter function we could allow other module to return a true or false value?

The reason behind this, with PM admins module, I allow other users to gain access to X user's inbox. Now, Id need to check if User X has access User Y's Inbox. If so, then return true, then the read_all variable would be set and everything would work flawlessly.

--

The other way I'm thinking of getting this to work, is cloning the privatemsg_thread_load function in my own module and altering the menu element but would I'd prefer adding the extra function in the module itself.

CommentFileSizeAuthor
#3 allmsg-module-invoke-1788226.patch1.61 KBwebadpro
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

litwol’s picture

I like the idea of being able to delegate access control to other modules.

What worries me is performance impact if we convert above simple check into a module_invoke* or equivalent.

My preference would be to maintain simplicity of current access check and extend it by adding another check for "extended access check enabled", and if so it will delegate access check to other modules via module_invoke*
By which i mean: Have both current implementation AND delegated permission check implementation in privatemsg, just make it possible to turn on and off via admin configuration.

Although, i haven't worked with privatemsg in a while... so take what i said with two grains of salt.

Lets see your patch :)

webadpro’s picture

Alright, I like the idea of having to enabling or disabling the extra permissions check-up but I'm not 100% sure if it is actually necessary.

I'll try to modify the code itself and see what I could come up with.

But any suggestion is greatly appreciated :)

webadpro’s picture

How about something like this patch?

This patch would work great for me, and would allow me to do exactly what i need.

ptmkenny’s picture

Status: Active » Needs review
ptmkenny’s picture

Issue summary: View changes

Extra details.

oadaeh’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

This issue is being closed because it is against a branch for a version of Drupal that is no longer supported.
If you feel that this issue is still valid, feel free to re-open and update it (and any possible patch) to work with the 7.x-1.x branch (bug fixes only) or the 7.x-2.x branch.
Thank you.