AppRestrictionsEnabled returns whether the specified organization has restricted third-party application access.
(org string)
| 24 | // AppRestrictionsEnabled returns whether the specified organization has |
| 25 | // restricted third-party application access. |
| 26 | func (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). |