{"action":"created","issue":{"url":"https://api.github.com/repos/rlidwka/sinopia/issues/207","labels_url":"https://api.github.com/repos/rlidwka/sinopia/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/rlidwka/sinopia/issues/207/comments","events_url":"https://api.github.com/repos/rlidwka/sinopia/issues/207/events","html_url":"https://github.com/rlidwka/sinopia/pull/207","id":58932268,"number":207,"title":"Feature/package provider","user":{"login":"crispy1989","id":2132722,"avatar_url":"https://avatars.githubusercontent.com/u/2132722?v=3","gravatar_id":"","url":"https://api.github.com/users/crispy1989","html_url":"https://github.com/crispy1989","followers_url":"https://api.github.com/users/crispy1989/followers","following_url":"https://api.github.com/users/crispy1989/following{/other_user}","gists_url":"https://api.github.com/users/crispy1989/gists{/gist_id}","starred_url":"https://api.github.com/users/crispy1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crispy1989/subscriptions","organizations_url":"https://api.github.com/users/crispy1989/orgs","repos_url":"https://api.github.com/users/crispy1989/repos","events_url":"https://api.github.com/users/crispy1989/events{/privacy}","received_events_url":"https://api.github.com/users/crispy1989/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-02-25T16:54:16Z","updated_at":"2015-04-11T20:34:16Z","closed_at":"2015-04-11T12:24:37Z","pull_request":{"url":"https://api.github.com/repos/rlidwka/sinopia/pulls/207","html_url":"https://github.com/rlidwka/sinopia/pull/207","diff_url":"https://github.com/rlidwka/sinopia/pull/207.diff","patch_url":"https://github.com/rlidwka/sinopia/pull/207.patch"},"body":"This pull request adds the ability to create authorization (ie, package provider) plugins (to control access to packages and publishing) in addition to the existing authentication plugins.  This is useful if an organization already has an access control infrastructure and doesn't want to duplicate roles across systems.\r\n\r\nA plugin using this structure that connects to [gitlab](https://gitlab.com) is [here](https://github.com/crispy1989/sinopia-gitlab) (it's not yet published to npm, pending this pull request).  It will automatically pull package data and access rights from corresponding repositories in gitlab.\r\n\r\nThis pull request contains the following changes to Sinopia, necessary to add this capability:\r\n* Move plugin loading code to a separate file to avoid duplicating common code for loading authentication and package provider plugins\r\n* Add additional code in the config parser to validate the package provider plugin specification and configuration; this is based on the config structure used for the authentication plugins\r\n* Create a file (packages.js) to handle providing package metadata and access control; this file mirrors the corresponding functions in config.js, except that the calls are asynchronous to allow for connecting to external services (such as in the above gitlab plugin)\r\n* Change code calling allow_access() and allow_publish() to be asynchronous\r\n\r\nThe changes are backwards compatible and do not break any existing configurations.\r\n\r\nThese plugins behave as follows:\r\n\r\nIf a package matches the \"packages\" section in the config file, and that section contains an object called \"plugin\", package information for that package is taken from that plugin.  Configuration for the plugin is taken from the object underneath the plugin name, see the gitlab plugin for an example.  If a plugin requires no configuration, it may be specified as a string instead of an object.\r\n\r\nMultiple plugins can be specified.  In this case, the first one that responds to a function with a non-undefined response is used.  If no plugins are specified, or all respond with 'undefined', the values specified in the configuration file are used.\r\n\r\nPlugins are constructed and instantiated in the same way, and with the same parameters, as auth plugins.\r\n"},"comment":{"url":"https://api.github.com/repos/rlidwka/sinopia/issues/comments/91922387","html_url":"https://github.com/rlidwka/sinopia/pull/207#issuecomment-91922387","issue_url":"https://api.github.com/repos/rlidwka/sinopia/issues/207","id":91922387,"user":{"login":"rlidwka","id":999113,"avatar_url":"https://avatars.githubusercontent.com/u/999113?v=3","gravatar_id":"","url":"https://api.github.com/users/rlidwka","html_url":"https://github.com/rlidwka","followers_url":"https://api.github.com/users/rlidwka/followers","following_url":"https://api.github.com/users/rlidwka/following{/other_user}","gists_url":"https://api.github.com/users/rlidwka/gists{/gist_id}","starred_url":"https://api.github.com/users/rlidwka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlidwka/subscriptions","organizations_url":"https://api.github.com/users/rlidwka/orgs","repos_url":"https://api.github.com/users/rlidwka/repos","events_url":"https://api.github.com/users/rlidwka/events{/privacy}","received_events_url":"https://api.github.com/users/rlidwka/received_events","type":"User","site_admin":false},"created_at":"2015-04-11T20:34:16Z","updated_at":"2015-04-11T20:34:16Z","body":"Merged and published as `sinopia@1.2.0`. I sent those changes in a pull request as you requested.\r\n\r\nThanks!"}}