permissions to email ad-hoc database queries

permissions to email ad-hoc database queries

by Tay Moss -
Number of replies: 8

I have users who have been assigned as Managers of Categories.

I want to generate and email reports to them using the ad-hoc database queries plugin.

I wrote an SQL statement which approriately filters the results to only the Category in question. 

So now I'm trying to set the "automically email results...' value and it only lists my system-wide admins. I double checked and under Site Adminstration > Users > Permissions > Define Roles > Manager   I have "report/customsql:view" set to Allow.

What am I missing? Can we only send the email results of the ad-hoc querries to system-level admins?

Average of ratings: -
In reply to Tay Moss

Re: permissions to email ad-hoc database queries

by Randy Thornton -
Picture of Documentation writers
Tay

You can add any valid Moodle username to the list to email reports to.

The pull down list only shows the Administrators. I presume this is to keep the list short. It doesn't show the other usernames, but if you enter them manually, it works. If you choose a username that does not exist, it will complain when you try to save the report. Those users don't need any permissions set at all to get the email.

The permissions are only needed for directly accessing the reports via url or the Site admin menu.
In reply to Randy Thornton

Re: permissions to email ad-hoc database queries

by Tay Moss -

I tried to enter it manually (both by username and by email), and it simply won't add them. There is no "complaint" it just won't let them add them at all. The only ones it will take are the ones on the drop down list (who are all admins). Can you check this on a 3.11 site to confirm that your experience is different than mine?

In reply to Tay Moss

Re: permissions to email ad-hoc database queries

by Randy Thornton -
Picture of Documentation writers
Have you set to the 'Run' type from 'On demand' to one of the 'Scheduled' options?
In reply to Randy Thornton

Re: permissions to email ad-hoc database queries

by Tay Moss -

Yes, that is correct. Like I said, I can send it to myself and other admins just fine. But it won't let me send it to anyone else. I think even checked the permissions of the user I had in mind and that didn't fix it. Even when I enabled them to view system-wide reports, they still don't appear as an option in this window.

In reply to Tay Moss

Re: permissions to email ad-hoc database queries

by Randy Thornton -
Picture of Documentation writers
Here's how I am doing it now:

Set up a System level role and set View custom queries report - report/customsql:view to Allow
Assign the users you want to get mailed reports to that system role
In the report set "Who can access this query" to "Anyone who can view this report (report/customsql:view)" and set the schedule.

Then they show up on the list to mail to.

If you are adding this report/customsql:view permission to the standard Manager role, then when you choose the "Anyone who can view this report" setting on the report, those names should be on the list. It works the same way for any system level role. In fact, if you add this permission to the Authenticated user, the pull down would show everyone. I've tested this in 3.11.


I have clearly forgotten (among many other things) that the way this works changed some time ago, in 3.9 actually. Before that, there was no pull down user list: it just checked any valid username in the system and generated an error if you added anything else, such as an email address. But since 3.9 you do need the permission set to email things as well, which is why the "Who can access this query" now controls the email pull down list.
Average of ratings: Useful (1)
In reply to Randy Thornton

Re: permissions to email ad-hoc database queries

by Randy Thornton -
Picture of Documentation writers
By the way, there is nothing wrong about assigning this permission to the Manager role if that is what you need. But my experience is that when I do, clients always then want to email some reports to folks who are not Managers. So, in the end I always end up creating a separate system level role for this anyway.
Average of ratings: Useful (1)
In reply to Randy Thornton

Re: permissions to email ad-hoc database queries

by Tay Moss -
Thanks, Randy, that was super helpful and did the trick!
I created a system-wide "Analyst" role and it looks like it's going to work great.