Elearning-HWR-Berlin / moodle-block_socialcomments

The social comments block plugin for Moodle increases engagement by fostering peer learning through comment subscription, email digests, comments newsfeed, comment search and pinning of important comments and content to the pin board. This plugin is part of a collection of open source plugins, which all have the goal to improve the overall usability/ user experience of Moodle.
1 stars 1 forks source link

simple capability checks unnecessarily abstracted in api function calls #5

Open danmarsden opened 5 years ago

danmarsden commented 5 years ago

https://github.com/Elearning-HWR-Berlin/moodle-block_social-comments/blob/master/classes/local/basepost.php#L79

it is better to make direct calls to has_capabilty in your inline code - wrapping capability/security checks inside extra functions makes it hard for reviewers looking to see if capabilities are implemented correctly.

This won't likely block approval in the plugins db, but I have been known to reject plugins developed by our staff here at Catalyst due to this extra level of unnecessary abstraction.

danmarsden commented 5 years ago

seems to be a few other examples of this sort of thing: https://github.com/Elearning-HWR-Berlin/moodle-block_social-comments/blob/master/classes/local/comments_helper.php#L258