adding test utils
This commit is contained in:
parent
3f49bb95ff
commit
6d384f342f
@ -1,11 +1,11 @@
|
||||
Writing a Plugin
|
||||
================
|
||||
|
||||
**The plugin interface is a work in progress.**
|
||||
|
||||
Several interfaces exist for extending Lemur:
|
||||
|
||||
* Issuers (lemur.issuers)
|
||||
* Issuer (lemur.plugins.base.issuer)
|
||||
* Destination (lemur.plugins.base.destination)
|
||||
* Source (lemur.plugins.base.source)
|
||||
|
||||
Structure
|
||||
---------
|
||||
@ -29,9 +29,9 @@ if you want to pull the version using pkg_resources (which is what we recommend)
|
||||
Inside of ``plugin.py``, you'll declare your Plugin class::
|
||||
|
||||
import lemur_pluginname
|
||||
from lemur.common.services.issuers.plugins import Issuer
|
||||
from lemur.plugins.base.issuer import IssuerPlugin
|
||||
|
||||
class PluginName(Plugin):
|
||||
class PluginName(IssuerPlugin):
|
||||
title = 'Plugin Name'
|
||||
slug = 'pluginname'
|
||||
description = 'My awesome plugin!'
|
||||
@ -55,27 +55,36 @@ And you'll register it via ``entry_points`` in your ``setup.py``::
|
||||
)
|
||||
|
||||
|
||||
That's it! Users will be able to install your plugin via ``pip install <package name>`` and configure it
|
||||
via the web interface based on the hooks you enabled.
|
||||
That's it! Users will be able to install your plugin via ``pip install <package name>``.
|
||||
|
||||
Interfaces
|
||||
==========
|
||||
|
||||
Lemur has several different plugin interfaces that are used to extend Lemur, each of them require
|
||||
that you subclass and override their functions in order for your plugin to function.
|
||||
|
||||
|
||||
Permissions
|
||||
===========
|
||||
Issuer
|
||||
------
|
||||
|
||||
As described in the plugin interface, Lemur provides a suite of permissions.
|
||||
Issuer plugins are to be used when you want to allow Lemur to use external services to create certificates.
|
||||
In the simple case this means that you have one Certificate Authority and you ask it for certificates given a
|
||||
few parameters. In a more advanced case this could mean that this third party not only allows you to create certifcates
|
||||
but also allows you to create Certificate Authorities and Sub Certificate Authorities.
|
||||
|
||||
In most cases, a admin (that is, if User.is_admin is ``True``), will be granted implicit permissions
|
||||
on everything.
|
||||
The `IssuerPlugin` interface only required that you implement one function::
|
||||
|
||||
This page attempts to describe those permissions, and the contextual objects along with them.
|
||||
def create_certificate(self, options):
|
||||
# requests.get('a third party')
|
||||
|
||||
.. data:: add_project
|
||||
Lemur will pass a dictionary of all possible options for certificate creation.
|
||||
|
||||
Controls whether a user can create a new project.
|
||||
Optionally the `IssuerPlugin` exposes another function for authority create::
|
||||
|
||||
::
|
||||
def create_authority(self, options):
|
||||
# request.get('a third party')
|
||||
|
||||
>>> has_perm('add_project', user)
|
||||
If implemented this function will be used to allow users to create external Certificate Authorities.
|
||||
|
||||
|
||||
Testing
|
||||
|
@ -17,10 +17,7 @@ class IssuerPlugin(Plugin):
|
||||
raise NotImplementedError
|
||||
|
||||
def create_authority(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_authorities(self):
|
||||
raise NotImplementedError
|
||||
raise NotImplemented
|
||||
|
||||
def get_csr_config(self):
|
||||
raise NotImplementedError
|
||||
|
0
lemur/pytest.py
Normal file
0
lemur/pytest.py
Normal file
Loading…
Reference in New Issue
Block a user