MCPcopy Create free account
hub / github.com/google/go-github / AppRestrictionsEnabled

Method AppRestrictionsEnabled

scrape/apps.go:26–45  ·  view source on GitHub ↗

AppRestrictionsEnabled returns whether the specified organization has restricted third-party application access.

(org string)

Source from the content-addressed store, hash-verified

24// AppRestrictionsEnabled returns whether the specified organization has
25// restricted third-party application access.
26func (c *Client) AppRestrictionsEnabled(org string) (bool, error) {
27 doc, err := c.get("/organizations/%v/settings/oauth_application_policy", org)
28 if err != nil {
29 return false, err
30 }
31
32 s := doc.Find(".oauth-application-allowlist svg").First()
33 if s.Length() == 0 {
34 return false, errors.New("unable to find expected markup")
35 }
36
37 if s.HasClass("octicon-check") {
38 return true, nil
39 }
40 if s.HasClass("octicon-alert") {
41 return false, nil
42 }
43
44 return false, errors.New("unable to find expected markup")
45}
46
47// ListOAuthApps lists the reviewed OAuth Applications for the
48// specified organization (whether approved or denied).

Callers 2

mainFunction · 0.95

Calls 1

getMethod · 0.95

Tested by 1