Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Inside plugin up() method
- my_module::up()
- {
- core::security().register_permission("my_module.do_sth", &my_module::do_sth);
- }
- // Perm check in base module
- class base_module {
- public:
- // Will be invoked in dedicated thread
- void main()
- {
- // ...
- m_running = true;
- while (m_running)
- {
- // Get message from priority queue
- auto message = m_queue.pop_front();
- // ...
- switch (message.type()) {
- // ...
- case message_type::REQUEST:
- core::request request = message;
- if (core::security().has_permission(request.fn, request.sender)) {
- auto wrapper = request.wrap(); // wrap fn into request wrapper, aka. bind all arguments
- wrapper(); // execute
- }
- break;
- // ...
- }
- }
- // ...
- }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement