Make role permissions dynamic

Allow for permissions to be registered dynamically. This will allow for the ability for models and plugins to register permissions.
This looks like a copy from a similar function in class Task. Should this maybe go to an abstract class or trait?