# Can i control the plugin enabled status in other plugin?

**URL:** <https://discuss.elastic.co/t/can-i-control-the-plugin-enabled-status-in-other-plugin/52681>\
**Category:** Kibana\
**Created:** [June 14, 2016, 2:25am UTC](https://discuss.elastic.co/t/can-i-control-the-plugin-enabled-status-in-other-plugin/52681 "2016-06-14T02:25:24Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [June 23, 2016, 4:35pm UTC](https://discuss.elastic.co/t/can-i-control-the-plugin-enabled-status-in-other-plugin/52681/11 "2016-06-23T16:35:01Z")

</div>

> [@whoami](#):
>
> make some workaround by intercepting the url.

One of the things we've done internally is to add some kind of validation in the plugin init step, which will set a variable (usually exposed on the `server` instance) that we can just check when we go to set up the routes.

```auto
module.exports = function (kibana) {
  var AppToDisable = 'myApp';

  return new kibana.Plugin({
    require: [AppToDisable],
    init: function (server, options) {
      server.expose('isDisabled', true);
      kibana.uiExports.navLinks.inOrder.forEach((navLink) => {
        if (navLink.title === AppToDisable) {
          kibana.uiExports.navLinks.delete(navLink);
        }
      });
    }
  });
}

```

Then in your route handler, just add a conditional based on `server.plugins.<myplugin>.isDisabled`, and don't set up the routes if it's true.

This, of course, works if you are trying to make the plugin disable itself, not so much if you are trying to make one plugin disable another, unless you start coupling plugins to other plugs (we've done this as well - using some universal setup plugin that controls which other plugins are disabled). You might be able to use hapi's preRoute hook (or whatever it's actually called) to abort early too, but I haven't tried this personally.

@whoami if you could share your solution here, even in summary, it would be helpful for others searching for a solution. Cheers!

---

_[View the full topic](https://discuss.elastic.co/t/can-i-control-the-plugin-enabled-status-in-other-plugin/52681)._
