In my plugin I have a function that writes to the database.
I am now adding a user (under cunsultant) that should only be able to do certain things in my plugin. For the new role to be able to use the function that adds to the database I need to give it the capablilty manage_options. That gives the user access to a lot of other plugins and things that should not be accessable.
How can I give a user access to manage_options on the fly, for a specific function or what is the best practices to do?