Skip to content

Commit 1fd0e52

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent 37c56fe commit 1fd0e52

File tree

14 files changed

+296
-64
lines changed

14 files changed

+296
-64
lines changed

Rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ compile '/v3/*' do
3030
filter :search
3131
filter :erb
3232
filter :kramdown, :toc_levels => [2]
33+
filter :enterprise_purge_filter
3334
filter :tip_filter
3435
filter :colorize_syntax,
3536
:colorizers => {:javascript => :rouge}

content/v3/enterprise.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@
22
title: Enterprise | GitHub API
33
---
44

5-
# Enterprise
5+
# Enterprise <%= fetch_content(:latest_enterprise_version) %>
66

77
* TOC
88
{:toc}
99

10-
GitHub Enterprise supports the same powerful API available on GitHub.com as well as its own set of API endpoints:
11-
12-
- Use the [Admin Stats][] API to get usage statistics
13-
- Use the [License][] API to get license information
14-
- Use the [Search Indexing][] API to queue up search indexing jobs
15-
- Use the [Management Console][] API to perform common administrative tasks
16-
- Use the [User Administration][] API to promote, demote, suspend, and unsuspend users
10+
[GitHub Enterprise](https://enterprise.github.com/) supports the same powerful API available on GitHub.com as well as its own set of API endpoints. You can find a list of these endpoints on the sidebar, with the exception of the [User Administration][] API, which is within its own section.
1711

1812
## Endpoint URLs
1913

@@ -33,21 +27,20 @@ http(s)://<em>hostname</em>/
3327

3428
Your Enterprise installation's API endpoints accept [the same authentication methods](http://developer.github.com/v3/#authentication) as the GitHub.com API. Specifically, you can authenticate yourself with **[OAuth tokens][]** (which can be created using the [Authorizations API][]) or **[basic authentication][]**.
3529

36-
The [Admin Stats][], [License][], [Search Indexing][], and [User Administration][] API endpoints are only accessible to GitHub Enterprise site administrators. The [Management Console][] API endpoints are only accessible via the [Management Console password][].
30+
Every Enterprise API endpoint is only accessible to GitHub Enterprise site administrators, with the exception of the [Management Console][] API, which is only accessible via the [Management Console password][].
3731

3832
[Authorizations API]: /v3/oauth_authorizations/#create-a-new-authorization
3933
[OAuth tokens]: /v3/oauth/
4034
[basic authentication]: /v3/#basic-authentication
41-
[Admin Stats]: admin_stats/
42-
[License]: license/
43-
[Search Indexing]: search_indexing/
44-
[Management Console]: management_console/
35+
[Management Console]: /v3/enterprise/management_console/
4536
[User Administration]: /v3/users/administration/
4637
[Management Console password]: https://help.github.com/enterprise/2.0/admin/articles/accessing-the-management-console/
4738

4839
## Past Releases
4940

50-
Documentation for the API that's bundled with your GitHub Enterprise appliance is available for the past two releases:
41+
The latest release for GitHub Enterprise is <%= fetch_content(:latest_enterprise_version) %>. The GitHub APIs available to this release are located at <https://developer.github.com/enterprise/<%= fetch_content(:latest_enterprise_version) %>/>.
42+
43+
Documentation for the API that's bundled with your GitHub Enterprise appliance is available for past releases:
5144

5245
* [API documentation for 2.0](https://developer.github.com/enterprise/2.0/)
5346
* [API documentation for 11.10.340](https://developer.github.com/enterprise/11.10.340/)

content/v3/enterprise/ldap.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
title: LDAP
3+
---
4+
5+
# LDAP
6+
7+
* TOC
8+
{:toc}
9+
10+
You can use the LDAP API to update account relationships between a GitHub Enterprise user and its linked LDAP entry or queue a new synchronization.
11+
12+
With the LDAP mapping endpoints, you're able to update the Distinguished Name (DN) that a user maps to. Note that the LDAP sync endpoints are only effective if your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap).
13+
14+
## Update LDAP mapping for a user
15+
16+
PATCH /admin/ldap/user/:username/mapping
17+
18+
### Body parameters
19+
20+
Pass a JSON payload with the new LDAP Distinguished Name.
21+
22+
#### Example
23+
24+
#!javascript
25+
{
26+
"uid": "asdf",
27+
"ou": "users",
28+
"dc": "github",
29+
"dc": "com"
30+
}
31+
32+
### Response
33+
34+
<%= headers 200 %>
35+
<%= json :ldap_user_update %>
36+
37+
## Sync LDAP mapping for a user
38+
39+
{{#tip}}
40+
41+
Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready.
42+
43+
{{/tip}}
44+
45+
POST /admin/ldap/user/:username/sync
46+
47+
### Response
48+
49+
<%= headers 201 %>
50+
<%= json :ldap_sync_confirm %>
51+
52+
## Update LDAP mapping for a team
53+
54+
PATCH /admin/ldap/teams/:team_id/mapping
55+
56+
### Body parameters
57+
58+
Pass a JSON payload with the new LDAP Distinguished Name.
59+
60+
#### Example
61+
62+
#!javascript
63+
{
64+
"cn": "Enterprise Ops",
65+
"ou": "teams",
66+
"dc": "github",
67+
"dc": "co"
68+
}
69+
70+
### Response
71+
72+
<%= headers 200 %>
73+
<%= json :ldap_team_update %>
74+
75+
## Sync LDAP mapping for a team
76+
77+
{{#tip}}
78+
79+
Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready.
80+
81+
{{/tip}}
82+
83+
POST /admin/ldap/user/:teamname/sync
84+
85+
### Response
86+
87+
<%= headers 201 %>
88+
<%= json :ldap_sync_confirm %>

content/v3/users/administration.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ You can demote any user account except your own.
3737

3838
## Suspend a user
3939

40+
{{#warning}}
41+
42+
If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be suspended via the API.
43+
44+
{{/warning}}
45+
4046
PUT /users/:username/suspended
4147

4248
You can suspend any user account except your own.
@@ -49,6 +55,12 @@ You can suspend any user account except your own.
4955

5056
## Unsuspend a user
5157

58+
{{#warning}}
59+
60+
If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be unsuspended via the API.
61+
62+
{{/warning}}
63+
5264
DELETE /users/:username/suspended
5365

5466
### Response

content/v3/users/emails.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ This endpoint is accessible with the user:email scope.
2323

2424
## Add email address(es)
2525

26+
{{#enterprise-only}}
27+
28+
{{#warning}}
29+
30+
If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an email address via the API with these options enabled.
31+
32+
{{/warning}}
33+
34+
{{/enterprise-only}}
35+
2636
POST /user/emails
2737

2838
### Input
@@ -49,6 +59,16 @@ You can post a single email address or an array of addresses:
4959

5060
## Delete email address(es)
5161

62+
{{#enterprise-only}}
63+
64+
{{#warning}}
65+
66+
If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an email address via the API with these options enabled.
67+
68+
{{/warning}}
69+
70+
{{/enterprise-only}}
71+
5272
DELETE /user/emails
5373

5474
### Input

content/v3/users/keys.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ authenticated via Basic Auth or via OAuth with at least `read:public_key`
5050
Creates a public key. Requires that you are authenticated via Basic Auth,
5151
or OAuth with at least `write:public_key` [scope](/v3/oauth/#scopes).
5252

53+
{{#enterprise-only}}
54+
55+
{{#warning}}
56+
57+
If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an SSH key address via the API with these options enabled.
58+
59+
{{/warning}}
60+
61+
{{/enterprise-only}}
62+
5363
POST /user/keys
5464

5565
### Input
@@ -72,6 +82,16 @@ instead.
7282
Removes a public key. Requires that you are authenticated via Basic Auth
7383
or via OAuth with at least `admin:public_key` [scope](/v3/oauth/#scopes).
7484

85+
{{#enterprise-only}}
86+
87+
{{#warning}}
88+
89+
If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an SSH key address via the API with these options enabled.
90+
91+
{{/warning}}
92+
93+
{{/enterprise-only}}
94+
7595
DELETE /user/keys/:id
7696

7797
### Response

layouts/sidebar.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ <h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></
112112
</ul>
113113
</li>
114114
<li class="js-topic">
115-
<h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></a><a href="/v3/enterprise/">Enterprise</a></h3>
115+
<h3><a href="#" class="js-expand-btn collapsed arrow-btn" data-proofer-ignore></a><a href="/v3/enterprise/">Enterprise <%= fetch_content(:latest_enterprise_version) %></a></h3>
116116
<ul class="js-guides">
117117
<li><a href="/v3/enterprise/admin_stats/">Admin Stats</a></li>
118118
<li><a href="/v3/enterprise/license/">License</a></li>
119119
<li><a href="/v3/enterprise/search_indexing/">Search Indexing</a></li>
120120
<li><a href="/v3/enterprise/management_console/">Management Console</a></li>
121+
<li><a href="/v3/enterprise/ldap/">LDAP</a></li>
121122
</ul>
122123
</li>
123124
</ul>

lib/enterprise-purge.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class EnterprisePurgeFilter < Nanoc::Filter
2+
identifier :enterprise_purge_filter
3+
type :text
4+
5+
ENTERPRISE_START_STRING = '{{#enterprise-only}}'
6+
ENTERPRISE_END_STRING = '{{/enterprise-only}}'
7+
8+
# if we're running in Dotcom mode, we'll be lazy and just hide the content.
9+
# otherwise, when running script/enterprise-cutter, we'll bring these sections back
10+
def run(content, params={})
11+
start_replacement = '<div class="enterprise-only">'
12+
end_replacement = '</div>'
13+
14+
content = content.gsub(%r{<p>#{ENTERPRISE_START_STRING}</p>}, start_replacement)
15+
content = content.gsub(%r{<p>#{ENTERPRISE_END_STRING}</p>}, end_replacement)
16+
17+
content
18+
end
19+
end

lib/resources.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
module GitHub
88
module Resources
99
module Helpers
10+
1011
STATUSES ||= {
1112
200 => '200 OK',
1213
201 => '201 Created',
@@ -117,6 +118,7 @@ def webhook_payload(event_name)
117118
end
118119

119120
CONTENT ||= {
121+
'LATEST_ENTERPRISE_VERSION' => '2.1',
120122
"PUT_CONTENT_LENGTH" => "Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP verbs](/v3/#http-verbs).\"",
121123
"ORG_HOOK_CONFIG_HASH" =>
122124
'''
@@ -2261,6 +2263,18 @@ def fetch_content(key)
22612263
"pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
22622264
}
22632265
]
2266+
2267+
LDAP_USER_UPDATE ||= {
2268+
'ldap_dn' => 'uid=asdf,ou=users,dc=github,dc=com'
2269+
}.merge(USER)
2270+
2271+
LDAP_TEAM_UPDATE ||= {
2272+
'ldap_dn' => 'cn=Enterprise Ops,ou=teams,dc=github,dc=com'
2273+
}.merge(TEAM)
2274+
2275+
LDAP_SYNC_CONFIRM ||= {
2276+
'status' => 'queued'
2277+
}
22642278
end
22652279
end
22662280

script/enterprise-backport

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env ruby
2+
3+
# Occasionally, a change made to the latest version of the Enterprise API documentation
4+
# will need to be backported to the previous verison. This script takes the latest content
5+
# for /enterprise and moves it into the appropriate version folder.
6+
7+
Dir.glob('tasks/*.rake').each { |r| load r }
8+
9+
if ARGV.length != 1
10+
error = '''Error: Run the script like this: bundle exec script/enterprise-backport [VERSION]
11+
e.g. bundle exec script/enterprise-cutter 2.0
12+
'''
13+
abort error
14+
end
15+
16+
version = ARGV[0].dup # like, 11.10.340
17+
18+
BRANCH_NAME = "backport-docs-for-#{version}"
19+
20+
setup
21+
22+
temp_dir = Dir.mktmpdir
23+
begin
24+
%x(git checkout `git rev-list -n 1 --before="#{date}" gh-pages`)
25+
`cp -r v3/enterprise #{temp_dir}`
26+
`git checkout #{BRANCH_NAME}`
27+
`cp -r #{temp_dir}/* enterprise/#{version}`
28+
29+
rewrite_content("enterprise/#{version}")
30+
31+
`git add enterprise`
32+
`git commit -m "Added enterprise-#{version} backported files"`
33+
ensure
34+
FileUtils.remove_entry_secure temp_dir
35+
end

0 commit comments

Comments
 (0)