Wiki

Case Status Kiln
Register Log In

Wiki

 
An Introduction to Plugins
  • RSS Feed

Last modified on 12/15/2014 5:11 PM by User.

Tags:

An Introduction to Plugins

FogBugz Plugins allow you to customize and extend FogBugz - they can add new features, modify existing behavior, or allow you to integrate your FogBugz with other programs.  You can browse existing plugins at the FogBugz Plugin Gallery and install them in just a few clicks.  Don't see the plugin you're looking for?  The FogBugz plugin architecture is designed to be easy to use - you can get started writing plugins in just a few minutes.

How Plugins Work

FogBugz plugins are .NET assemblies that run on the FogBugz server. Plugins interact with FogBugz in two ways: interfaces and APIs. Together, they allow plugins to extend and expand the power of FogBugz.

Interfaces

All FogBugz plugins implement one or more interfaces. Interfaces control when and how FogBugz calls into the plugin; for example, the methods of the IPluginBugDisplay interface will be called whenever a bug is being displayed or edited, allowing a plugin to add its own display elements to the bug page. A complete list of the predefined interfaces with examples and links to the class library documentation can be found here.

APIs

FogBugz plugins also have access to a variety of plugin APIs (contained in the FogCreek.FogBugz.Plugins.Api namespace) which allow plugins to communicate with FogBugz. For example, an API method might load a CBug object (a case), make changes and commit it back to the database. APIs allow plugins to request a wide variety of data from FogBugz and manipulate it in various ways. More information on the APIs that plugins can be found in the FogBugz Class Library Documentation.

What Plugins Can and Can't Do (Plugin Security)

Code Security

FogBugz plugins exist as code that runs on the FogBugz server, but they are limited in the ways that they can interact with FogBugz and with the server that they exist on.  All FogBugz plugins run in a special .NET AppDomain which limits the permissions of the code that runs inside it. For example, plugins are denied direct filesystem and database permissions to prevent them from executing malicious code on the server. Instead, they must use the APIs that FogBugz provides, which give controlled access to the database and very limited access to the filesystem. (See AppDomains and Plugin Code Security for more info)

Permissions

In general, plugins are considered by FogBugz to have all the permissions of FogBugz administrators: they can see every project, case, wiki, and discussion group and manipulate them in the same defined ways that FogBugz administrators can. They are allowed to query data from the database, and can add their own tables to the database, but they are restricted in the ways that they can insert or delete data in existing FogBugz tables. (See Generic Database Access and Implementing IPluginDatabase for more information)

User Interface

FogBugz plugins can add elements to the user interface in a variety of ways, including adding columns to the grid view, adding fields to bugs, and adding their own custom pages.  They cannot, in general, remove elements from the interface or modify existing behavior except through predefined interfaces and APIs. All of the areas plugins can add to are listed in FogBugz Plugin Interfaces.

Web Access

FogBugz plugins are allowed to communicate with the rest of the world through web (HTTP) requests. This allows plugins to integrate with other products that expose a web-accessible interface. (See How To Access An External API)

Installing and Using Plugins in FogBugz

  1. Plugin Gallery: The easiest way to install pre-built plugins is through the FogBugz Plugin Gallery.
     
  2. Plugin Settings Page: FogBugz administrators can upload Plugins via FogBugz. Just go to Admin -> Plugins and click "Upload Plugin" then browse to your .dll or .zip file and click OK to upload and install. FogBugz will make sure that the plugin is valid and report any errors.
     
  3. Manually: Plugins can also be installed manually by putting a zip archive of your dll directly in your-fogbugz-dir/Plugins/upload. This is especially useful during development, as you can include this step in your automated build script.

Once installed, plugins are configured via the "Configure" icon next to their names on the Plugin admin page. The icon only appears next to plugins that have configurable options.

Where To Start

To get started developing plugins, try coding the tutorials. Start with Hello, world which walks you through setting up your development environment and coding, compiling and installing the timeless classic. References for all plugin interfaces are also available with screenshots and sample code in FogBugz Plugin Interfaces.