I need help setting permissions so that teachers can blog, but students can't

I need help setting permissions so that teachers can blog, but students can't

by Rob Johnson -
Number of replies: 4
I need some help with roles and Moodle blog.

My school district wants to allow teachers to use the site level Moodle blog, but make student access read only. I have been trying different permissions to see if this is possible, but have run into problems. At the site level, most users have the role of "Authenticated User." If I restrict blog permissions for this role, it seems to place restriction for all but Administrators.

I tried to create a role called "Blogger," and set permissions to allow blogging. I gave a test account this role at the site level, and this did not work. Is this the right path? Is there a better way to do this?

Thanks,
Rob
Average of ratings: -
In reply to Rob Johnson

Re: I need help setting permissions so that teachers can blog, but students can't

by John Isner -
Hi Rob,
It looks like you did your homework. As you discovered, there is no way to automatically distinguish teachers from students in the System context.

You can define a role CannotCreateBlogEntries with moodle/blog:create ("Create new blog entries") = Prevent and all other permissions Not set. Manually assign this role to students in the System context. You're going to have to figure out how to sort out the students from teachers and other users.

Bulk user actions (Site administration -> Users -> Accounts -> Bulk user actions) has an "advanced" filter feature that would allow you to quickly extract the user names of users who are assigned the Student role in any course (this is an abuse of roles and should be removed). Unfortunately, it does not have "assign a role" as one of the "With selected users..." dropdown. You could at least get the usernames this way.

Once you get the student user names, you could create an upload users csv, but unfortunately bulk user upload only supports role assignment in course contexts. Vote for MDL-15187.

IMO the best solution for your use case would be the improvement suggested in MDL-14298. The idea is to allow users to specify role assignment triggers in contexts. A trigger consists of (1) a test and (2) a role name. A trigger causes Moodle to automatically assign a role if the user entering the context passes the test. One possible test could be a regular expression match against a profile field or the username. We would need a new tab in the Roles user interface for setting up triggers. In your case, the administrator would create a trigger in the System context with (1) a test that recognizes student users (perhaps based on their ID number) (2) the role CannotCreateBlogEntries, defined above.

Thank you for providing another use case for MDL-14298! I will add a comment referencing this discussion there. Please vote!
In reply to John Isner

Re: I need help setting permissions so that teachers can blog, but students can't

by James Tuttle -

Yes, this is exactly the kind of thing I am looking for, only in our case we have our entire school website running on Moodle, so we want to be able to distinguish general public users from students & staff.

Half the battle is getting the system to distinguish one type of user from another, i.e. "student -vs- teacher", but once you do that, it would be nice to be able to trigger a defined role based on that criteria.  There's an interesting discussion going on about how to distinguish students from parents in http://moodle.org/mod/forum/discuss.php?d=70539.  You could distinguish students from teachers based perhaps on a difference in their user name.  In our case, all of our students & staff use LDAP accounts, and the general public will create manual accounts, so that could be our "trigger."

In reply to James Tuttle

Re: I need help setting permissions so that teachers can blog, but students can't

by John Isner -
Rob,
I'm involved in the discussion you mentioned. The parent/student case is quite similar to yours, and I mention it in MDL-14298.

I encourage you to add your own comments to any of the tracker issues I mentioned. But even if you don't comment, please vote. Developers tend not to notice issues with 0 votes smile
In reply to John Isner

Re: I need help setting permissions so that teachers can blog, but students can't

by Rob Johnson -
Thank you for the guidance John. I have voted for both issues.

RJ