Problem/Motivation

Would be nice to add the ability to set the subscribe/unsubscribe permission per individual newsletter. Some newsletters you may want to restrict to just authenticated users, or to admins and so forth. If this is already included and I missed it I apologize, though I've not seen it yet.

Use case:

There are two roles:

  • A standard "Member" role
  • A "Premium" role

There are two newsletters:

  • A "News" newsletter for everyone
  • A "Premium" newsletter for users with the "Premium" role

Desired result:

  • "News" newsletter: Anonymous users (via "Simplenews subscription" block) and users with "Member" and "Premium" role can subscribe
  • "Premium" newsletter: Only members with the role "Premium" can subscribe to the "Premium" newsletter

Is this possible?

Steps to reproduce

Want to have fine grained control over subscriptions by role, but not see how it's possible.

Proposed resolution

Add fine grained control by role over who can subscribe to specific newsletters.

Remaining tasks

Add this feature, alternatively document how to do it, perhaps with another contrib module?

User interface changes

API changes

Data model changes

Comments

simon georges’s picture

Nope, it's not included, but it's more of a taxonomy access control matter than a Simplenews issue, I think.
Did you try modules like Acces By Term, or things like that ?
(On a side note, I think those kind of modules is targeted at node handling, not directly terms, so maybe Simplenews would have to add a fonctionnality...). I let this issue open, to think about it).

michaellander’s picture

Simon, I'll try a few different methods and see if I can find some means of making it work. I can also work on a patch to add it to simplenews, or I can possibly create a sub-module that adds it. Thanks for considering it!

simon georges’s picture

Well, if you come to something clean, don't hesitate to post it here, if I find some time, I'll try on my side.

berdir’s picture

I don't know if there are any taxonomy term restriction modules available, but core does define the 'term_access' query tag, so it should be possible to write one. Note that most modules of these modules, including the linked one in #1, are about node_access by using term assignements for the configuration. So that doesn't help here.

So to implement this, we'd need to make sure to either add a term_access tag to all taxonomy_term_data queries and also properly for success in check all cases where a category is loaded and fail gracefully in case access is denied.

That said, the problem with that approach is that's all or nothing. You either have access or you don't. To implement for example the ability to control which users can create newsletters of which category, we'd need to explicitly check and define permissions for each term.

This is possible but has some downsides, e.g. that the list of permissions can get really long and is then complicated to set up if you have 10, 20 or even more different newsletters.

miro_dietiker’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes

Promoting to 8.x roadmap / wishes.

adamps’s picture

#1, #4: NB This issue is about access to control access per newsletter to subscribe. It's not about access to create/send newsletters.

the list of permissions can get really long

We already have an additional option on the newsletter: hidden (no access) / visible (anyone access). We can add a third state: create permission (selective access).

geek-merlin’s picture

I suppose access via group/og integration might be a viable (if not better) alternative for some use cases.

adamps’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev

Anyone is welcome to create a separate project for integration with another contrib module (of course check if there is already one). This issue is for permissions per-newsletter. I don't see that we can say either approach is better than the other - different sites will have different needs.

adamps’s picture

Version: 8.x-2.x-dev » 3.x-dev
ressa’s picture

Title: Permissions Per-Newsletter » Permissions Per-Newsletter: Limit subscription options by role
Version: 3.x-dev » 4.x-dev
Component: Usability » Code
Issue summary: View changes

I am also looking for this, and am adding the relevant Issue Summary from a now "closed as duplicate" issue.

It would be fantastic to be able to control subscription options by role.