...so that it's possible to enable or disable open registration on a
per-remote basis.
For example, the `DRONE_REGISTRATION_OPEN` environment variable now
becomes `DRONE_GITHUB_OPEN` when using GitHub as a remote.
The default for open registration in this commit is `false` (disabled),
which matches the existing behaviour.
This is useful if you need to support both public and private remotes,
e.g. GitHub.com and GitHub Enterprise, where you trust all of the
private users and want to allow open registration for those but would
not want all GitHub.com users to run builds on your server.
Tested with GitHub and GitLab.
Allow the GitHub and GitHub Enterprise remotes to restrict who can login
based on a user's organisation membership. This can be used as a safe
addition to open registration and also ensures that access is revoked when a
user is subsequently removed from the org. The default is not to restrict at
all.
To test that it correctly authorises a valid user, prior to me extending it.
This only tests the happy path because simulating oAuth failures is going
to be quite hard at this stage.
The example JSON taken from GitHub's API documentation doesn't indicate that
`login` is the name of an organisation rather than a user. Change it to
something that looks more like an org, because it will make a test that I'm
about to add more readable. The endpoint name changes accordingly.
This allows you to restrict email notifications to only be sent after the build changes from success to failure or failure to success. It errs on the side of sending the notification; if the build is in another state (hung, for instance) or there was no previous build on the branch the email will also be sent.
Since the notify plugin shouldn't really have any responsibility for querying the database to find the previous commit's status, we store it on the commit when we save it.