Yes, it’s possible. You should go through to the available methods in plugin/instance.rb file. You can also check existing plugin codes to learn about how they handling different situations. And go through Developing Discourse Plugins - Part 1 - Create a basic plugin.
Edit: You can also monkey patch controller methods.