| 1 | export type ScopeGroup = "repo" | "org" | "user" | "key" | "delete" | "other"; |
| 2 | |
| 3 | export type ScopeDescription |
| 4 | /** A few words, read first. */ |
| 5 | title: string |
| 6 | /** One sentence on what it reaches. */ |
| 7 | detail: string |
| 8 | group: ScopeGroup |
| 9 | }; |
| 10 | |
| 11 | /** What each GitHub scope lets an app do, in the words a person approving it needs. Scopes Ghost does not check yet are described as GitHub grants them, so nobody approves more than they read. */ |
| 12 | const SCOPES: Record |
| 13 | repo: { |
| 14 | title: "Full access to your repositories", |
| 15 | detail: |
| 16 | "Read and write every repository you can, private ones included, and push to them.", |
| 17 | group: "repo", |
| 18 | }, |
| 19 | public_repo: { |
| 20 | title: "Write to your public repositories", |
| 21 | detail: |
| 22 | "Change issues and code in your public repositories, and push to them.", |
| 23 | group: "repo", |
| 24 | }, |
| 25 | "read:org": { |
| 26 | title: "See your organizations", |
| 27 | detail: "The organizations you belong to, and their members.", |
| 28 | group: "org", |
| 29 | }, |
| 30 | "write:org": { |
| 31 | title: "Manage organization members", |
| 32 | detail: "Invite and remove members of organizations you administer.", |
| 33 | group: "org", |
| 34 | }, |
| 35 | "admin:org": { |
| 36 | title: "Administer your organizations", |
| 37 | detail: "Full control of the organizations you administer.", |
| 38 | group: "org", |
| 39 | }, |
| 40 | user: { |
| 41 | title: "Read and change your profile", |
| 42 | detail: "Your profile, and the email addresses on your account.", |
| 43 | group: "user", |
| 44 | }, |
| 45 | "read:user": { |
| 46 | title: "Read your profile", |
| 47 | detail: "Your name, username and other profile details.", |
| 48 | group: "user", |
| 49 | }, |
| 50 | "user:email": { |
| 51 | title: "See your email addresses", |
| 52 | detail: "Every address on your account, private ones included.", |
| 53 | group: "user", |
| 54 | }, |
| 55 | "read:public_key": { |
| 56 | title: "See your SSH keys", |
| 57 | detail: "The public keys you push and pull with.", |
| 58 | group: "key", |
| 59 | }, |
| 60 | "write:public_key": { |
| 61 | title: "Add SSH keys", |
| 62 | detail: "Add a key that can then push and pull as you.", |
| 63 | group: "key", |
| 64 | }, |
| 65 | "admin:public_key": { |
| 66 | title: "Manage your SSH keys", |
| 67 | detail: "See, add and remove the keys that push and pull as you.", |
| 68 | group: "key", |
| 69 | }, |
| 70 | delete_repo: { |
| 71 | title: "Delete repositories", |
| 72 | detail: "Permanently delete repositories you administer.", |
| 73 | group: "delete", |
| 74 | }, |
| 75 | gist: { |
| 76 | title: "Create gists", |
| 77 | detail: "Ghost has no gists, so this grants nothing here.", |
| 78 | group: "other", |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | export function describeScope(scope |
| 83 | return ( |
| 84 | SCOPES[scope] ?? |
| 85 | title: scope, |
| 86 | detail: "Not used by Ghost.", |
| 87 | group: "other", |
| 88 | } |
| 89 | ); |
| 90 | } |