зеркало из
1
0
Форкнуть 0
Entitlements plugin to manage GitHub Orgs and Team memberships and access
Перейти к файлу
grantbirki 640ad3a175
add MIT license
2022-06-07 10:22:46 -06:00
.github/workflows entitlements-github-plugin 2022-06-07 12:17:36 -04:00
bin entitlements-github-plugin 2022-06-07 12:17:36 -04:00
lib/entitlements entitlements-github-plugin 2022-06-07 12:17:36 -04:00
script entitlements-github-plugin 2022-06-07 12:17:36 -04:00
spec entitlements-github-plugin 2022-06-07 12:17:36 -04:00
vendor/cache entitlements-github-plugin 2022-06-07 12:17:36 -04:00
.gitignore entitlements-github-plugin 2022-06-07 12:17:36 -04:00
.rubocop.yml entitlements-github-plugin 2022-06-07 12:17:36 -04:00
.ruby-version entitlements-github-plugin 2022-06-07 12:17:36 -04:00
Gemfile entitlements-github-plugin 2022-06-07 12:17:36 -04:00
Gemfile.lock entitlements-github-plugin 2022-06-07 12:17:36 -04:00
LICENSE add MIT license 2022-06-07 10:22:46 -06:00
README.md add code blocks 2022-06-07 10:22:12 -06:00
VERSION entitlements-github-plugin 2022-06-07 12:17:36 -04:00
entitlements-github-plugin.gemspec entitlements-github-plugin 2022-06-07 12:17:36 -04:00

README.md

entitlements-github-plugin

acceptance test lint coverage style

entitlements-github-plugin is an entitlements-app plugin allowing entitlements configs to be used to manage membership of GitHub.com Organizations and Teams.

Usage

Your entitlements-app config config/entitlements.yaml runs through ERB interpretation automatically. You can extend your entitlements configuration to load plugins like so:

<%-
  unless ENV['CI_MODE']
    begin
      require_relative "/data/entitlements/lib/entitlements-and-plugins"
    rescue Exception
      begin
        require_relative "lib/entitlements-and-plugins"
      rescue Exception
        # We might not have the plugins installed and still want this file to be
        # loaded. Don't raise anything but silently fail.
      end
    end
  end
-%>

You can then define lib/entitlements-and-plugins like so:

#!/usr/bin/env ruby
# frozen_string_literal: true

ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", File.dirname(__FILE__))
require "bundler/setup"
require "entitlements"

# require entitlements plugins here
require "entitlements/backend/github_org"
require "entitlements/backend/github_team"
require "entitlements/service/github"

Any plugins defined in lib/entitlements-and-plugins will be loaded and used at entitlements-app runtime.

Features

Org Team

entitlements-github-plugin manages org team membership to two roles - admin and member. Your entitlements-app config config/entitlements.yaml is used to configure the location for the declarations of this membership.

  github.com/github/org:
    addr: <%= ENV["GITHUB_API_BASE"] %>
    base: ou=org,ou=github,ou=GitHub,dc=github,dc=com
    dir: github.com/github/org
    org: github
    token: <%= ENV["GITHUB_ORG_TOKEN"] %>
    type: "github_org"

entitlements-github-plugin will look in the defined location above, github.com/github/org, for admin.txt and member.txt defining the respective membership for each role.

GitHub Teams

entitlements-github-plugin manages membership for all teams listed in the defined subfolder. The plugin will use extension-less name of the file as the team name. GitHub Team management can be configured like so:

  github.com/github/teams:
    addr: <%= ENV["GITHUB_API_BASE"] %>
    base: ou=teams,ou=github,ou=GitHub,dc=github,dc=com
    dir: github.com/github/teams
    org: github
    token: <%= ENV["GITHUB_ORG_TOKEN"] %>
    type: "github_team"

For example, if there were a file github.com/github/teams/new-team.txt with a single user inside, a GitHub.com Team would be created in the github org with the name new-team.

Metadata

Entitlements configs can contain metadata which the plugin will use to make further configuration decisions.

metadata_parent_team_name - when defined in an entitlements config, the defined team will be made the parent team of this GitHub.com Team.