sympa-community / sympa

Sympa, Mailing List Management Software
https://www.sympa.community/sympa
GNU General Public License v2.0
243 stars 96 forks source link

Use of internal variables in data_sources .incl files #1595

Closed qosobrin closed 1 year ago

qosobrin commented 1 year ago

Version

6.2.60

Installation method

Debian Bullseye package

Additional information

I manage a server with a couple of hundred lists and I need a list (call it server-status@domain.com) whose subscribers are the owners and/or editors of the rest of lists of a particular domain (robot) in my server. For that purpose I created a custom data source that queries my sympa database, something like this:

include_sql_query
name        All list owners
db_type     mysql
db_host     localhost
db_user     ro_user
db_passwd   XXXXXXXXXXXXXXX
db_name     sympa
sql_query   SELECT DISTINCT user_admin FROM sympa.admin_table WHERE role_admin = '[% param.0 %]' AND robot_admin = '[% param.1 %]'

The problem is that this query also includes the owner of the list that is performing the query, server-status@domain.com in my case. Since I want to make this data source usable in more lists I wonder if it is possible to use a Sympa internal variable in the sql_query that prevents this from happening, something like:

sql_query   SELECT DISTINCT user_admin FROM sympa.admin_table WHERE role_admin = '[% param.0 %]' AND robot_admin = '[% param.1 %]' AND list_admin != '[listname]'

Thank you very much. Best regards.

racke commented 1 year ago

We lack sync exclusions for owners and editors. This would be helpful here.

qosobrin commented 1 year ago

We lack sync exclusions for owners and editors. This would be helpful here.

Sure, that's why I try to perform the exclusion at the SQL query level. In general I feel like Sympa misses some important functionality regarding inclusions. For example, I think that list inclusion should allow to select both the role from the included list and the role in the destination list. I mean, it should be useful if I could include in list A all the owner of list B, but it would also be useful if I could include as editors in list A all the subscribers in list B. Actually I was about to open a Feature Request case for this functionality.

qosobrin commented 1 year ago

It seems that no one can provide and answer to my question so I understand that like a "it is not possible " answer. So I'm closing this issue.

I emphasize the necessity to have a much stronger list inclusion process, one where we can select the role both in the source list and in the target list.

Thank you very much and best regards to everyone.