0

I am currently trying to build a plugin for Confluence and I am wondering wether it is possible to have my plugin be disabled for certain spaces inside confluence.

For clearing things up: I have A, B, C, D as Confluence spaces. Inside Spaces A and B the users should be able to use the plugin. For spaces C and D the plugin should not be usable.

I couldn't find how I could "deactivate" the plugin for the C and D spaces. Hopefully I made myself clear.

Any help is appreciated :)

Mehrad Rafigh
  • 156
  • 1
  • 7
  • 20
  • What does you plugin do? Is it a macro? As far as I know there is no built-in solution for this. I assume you have to code the restriction yourself. – ppasler Nov 14 '16 at 17:57
  • hey @ppasler thank you for your answer. The plugin is a macro and displays a diagram. Do you have any clue, how I could achieve that or any resources on how one could takle this issue would be great :) – Mehrad Rafigh Nov 14 '16 at 18:58

2 Answers2

0

As mentioned in the comment, there is no built-in way to do this. You have to code the restriction yourself, which means to check the current space and decide wether the macro should be shown or not.

  1. If you know the restricted spaces and they do not change often over time, you could hard-code them in your plugin. If they do change often, you could add a configuration for your plugin (Adding a Configuration UI for your Plugin).
  2. Now you have to compare the current space from the macro caller with the "restriction" list (get space in macro config).
  3. Now you can either render the macro or render a error message

This solution does only prevent the rendering in certain spaces! The macro can be seen everywhere in the macro browser and can be inserted even to restricted spaces.

ppasler
  • 3,579
  • 5
  • 31
  • 51
0

@ppasler is right. AFAIK, there is no built-in solution for what you want. But here's a workaround that might work if you can't modify the macro code. Create a content transformer (How to Intercept Confluence Content Before it’s Rendered) which intercepts Confluence content before it is rendered. Then hook up the content transformer with a space admin screen (How to Add a Space Admin Screen to Your Confluence Add-on) that will handle the space restriction configuration.

jpllosa
  • 2,066
  • 1
  • 28
  • 30