Skip to content

Commit da49683

Browse files
committed
fix(docs): caveat the Dataverse scope, and correct four descriptions
The Dataverse row is the resource scope the connector declares, but binding an environment requests that environment's `/.default` instead (`microsoft-dataverse.ts:8`), so the table alone claimed a request the runtime does not make. Added `SERVICE_SCOPE_NOTES` for a caveat the rows of one service cannot carry, rendered in the same slot as the opt-in note. The Word page contradicted itself: its Permissions prose said connecting grants `Files.Read` and `Files.ReadWrite` and that those cover SharePoint, while the table right below lists the `.All` pair added in this PR. The prose predates that change and was wrong on its own terms, since the basic pair reaches only the signed-in user's own drive. It now says which pair does what and links to the table. Three labels understated their grant: `LicenseAssignment.ReadWrite.All` omitted read, Shopify's `write_merchant_managed_fulfillment_orders` omitted the read that every Shopify `write_` scope carries, and `meetings.space.created` read as covering every Meet space rather than the ones created through Sim. Swept the whole table for the same shape rather than fix them one per review round.
1 parent 69e59f6 commit da49683

10 files changed

Lines changed: 59 additions & 13 deletions

File tree

apps/docs/content/docs/integrations/google_meet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Connecting Google Meet through OAuth requests these scopes.
4040
| ----- | ----------- |
4141
| `https://www.googleapis.com/auth/userinfo.email` | View email address |
4242
| `https://www.googleapis.com/auth/userinfo.profile` | View basic profile info |
43-
| `https://www.googleapis.com/auth/meetings.space.created` | Create and manage Google Meet meeting spaces |
43+
| `https://www.googleapis.com/auth/meetings.space.created` | Create Google Meet spaces and manage the ones created through Sim |
4444
| `https://www.googleapis.com/auth/meetings.space.readonly` | View Google Meet meeting space details |
4545

4646
## Actions

apps/docs/content/docs/integrations/microsoft_ad.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Connecting Azure AD through OAuth requests these scopes.
4747
| `Group.ReadWrite.All` | Read and write all groups |
4848
| `GroupMember.ReadWrite.All` | Read and write all group memberships |
4949
| `LicenseAssignment.Read.All` | Read license assignments and subscribed SKUs |
50-
| `LicenseAssignment.ReadWrite.All` | Assign and remove user licenses |
50+
| `LicenseAssignment.ReadWrite.All` | Read, assign, and remove user licenses |
5151
| `UserAuthenticationMethod.ReadWrite.All` | Read and reset authentication methods and passwords for all users |
5252
| `AuditLog.Read.All` | Read sign-in and directory audit logs |
5353
| `Application.Read.All` | Read all applications and service principals |

apps/docs/content/docs/integrations/microsoft_dataverse.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Connecting Microsoft Dataverse through OAuth requests these scopes.
4545
| `https://dynamics.microsoft.com/user_impersonation` | Access Microsoft Dataverse on your behalf |
4646
| `offline_access` | Access account when not using the application |
4747

48+
Connecting a specific environment requests `<environment-url>/.default` instead of the resource scope above, so the scope Sim asks for depends on the environment you pick.
49+
4850
## Actions
4951

5052
### Associate Microsoft Dataverse Records

apps/docs/content/docs/integrations/microsoft_dynamics_365.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Connecting Microsoft Dynamics 365 CRM through OAuth requests these scopes.
3939
| `https://dynamics.microsoft.com/user_impersonation` | Access Microsoft Dataverse on your behalf |
4040
| `offline_access` | Access account when not using the application |
4141

42+
Connecting a specific environment requests `<environment-url>/.default` instead of the resource scope above, so the scope Sim asks for depends on the environment you pick.
43+
4244
## Actions
4345

4446
### List Microsoft Dynamics 365 CRM Records

apps/docs/content/docs/integrations/microsoft_word.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Word splits a sentence across several internal runs whenever formatting changes
6565

6666
### Permissions
6767

68-
Connecting a Microsoft account grants Sim `Files.Read` and `Files.ReadWrite`, the permissions Microsoft Graph requires to read and write drive items. The same permissions cover SharePoint document libraries the account can already reach — Sim never gains access to anything the signed-in account could not open itself.
68+
Connecting a Microsoft account grants Sim the `Files` permissions Microsoft Graph requires to read and write drive items, listed in full under [Scopes](#scopes). `Files.Read` and `Files.ReadWrite` cover your own OneDrive; the `.All` variants are what make a SharePoint document library work, because the basic pair reaches only the signed-in user's own drive. Sim never gains access to anything the signed-in account could not open itself.
6969
{/* MANUAL-CONTENT-END */}
7070

7171

apps/docs/content/docs/integrations/shopify.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Connecting Shopify through OAuth requests these scopes.
4040
| `write_customers` | Read and manage Shopify customers |
4141
| `write_inventory` | Read and manage Shopify inventory levels |
4242
| `read_locations` | View store locations |
43-
| `write_merchant_managed_fulfillment_orders` | Create fulfillments for orders |
43+
| `write_merchant_managed_fulfillment_orders` | Read orders and create fulfillments for them |
4444

4545
## Actions
4646

apps/docs/content/docs/platform/self-hosting/integrations-oauth.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ Every connector below also requests `openid`, `profile`, `email`, `offline_acces
262262
| OneDrive | `onedrive` | `Files.Read`, `Files.ReadWrite` |
263263
| SharePoint | `sharepoint` | `Sites.Read.All`, `Sites.ReadWrite.All`, `Sites.Manage.All` |
264264

265+
Connecting a specific environment requests `<environment-url>/.default` instead of the resource scope above, so the scope Sim asks for depends on the environment you pick.
266+
265267
### Monday.com
266268

267269
`MONDAY_CLIENT_ID` / `MONDAY_CLIENT_SECRET`

apps/sim/lib/oauth/scopes.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,21 @@ export const OAUTH_SCOPES = {
577577
/** Service ids that declare a scope set. */
578578
export type OAuthScopedService = keyof typeof OAUTH_SCOPES
579579

580+
/**
581+
* A caveat the scope rows of one service cannot carry on their own, keyed by
582+
* service id.
583+
*
584+
* Dataverse is the case that forced this: the row below is the resource scope
585+
* the connector declares, but binding an environment swaps it for that
586+
* environment's `/.default`, so a table printed without the caveat claims to
587+
* list a request the runtime does not make.
588+
*/
589+
export const SERVICE_SCOPE_NOTES = {
590+
'microsoft-dataverse':
591+
'Connecting a specific environment requests `<environment-url>/.default` instead of the ' +
592+
'resource scope above, so the scope Sim asks for depends on the environment you pick.',
593+
} as const satisfies Record<string, string>
594+
580595
/**
581596
* Scopes a service requests only where the deployment has opted in, keyed by
582597
* service id.
@@ -643,7 +658,7 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
643658
'https://www.googleapis.com/auth/chat.messages.readonly':
644659
'View messages in Google Chat spaces you are a member of',
645660
'https://www.googleapis.com/auth/meetings.space.created':
646-
'Create and manage Google Meet meeting spaces',
661+
'Create Google Meet spaces and manage the ones created through Sim',
647662
'https://www.googleapis.com/auth/meetings.space.readonly':
648663
'View Google Meet meeting space details',
649664
'https://www.googleapis.com/auth/cloud-platform':
@@ -859,7 +874,7 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
859874
'GroupMember.ReadWrite.All': 'Read and write all group memberships',
860875
'Directory.Read.All': 'Read directory data',
861876
'LicenseAssignment.Read.All': 'Read license assignments and subscribed SKUs',
862-
'LicenseAssignment.ReadWrite.All': 'Assign and remove user licenses',
877+
'LicenseAssignment.ReadWrite.All': 'Read, assign, and remove user licenses',
863878
'UserAuthenticationMethod.ReadWrite.All':
864879
'Read and reset authentication methods and passwords for all users',
865880
'AuditLog.Read.All': 'Read sign-in and directory audit logs',
@@ -997,7 +1012,7 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
9971012
write_customers: 'Read and manage Shopify customers',
9981013
write_inventory: 'Read and manage Shopify inventory levels',
9991014
read_locations: 'View store locations',
1000-
write_merchant_managed_fulfillment_orders: 'Create fulfillments for orders',
1015+
write_merchant_managed_fulfillment_orders: 'Read orders and create fulfillments for them',
10011016

10021017
// Zoom scopes
10031018
'user:read:user': 'View Zoom profile information',

scripts/generate-docs.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,18 @@ describe('the generated Scopes section', () => {
988988
* app: Slack rejects the whole authorization when the app is not approved for
989989
* one, so omitting them entirely costs that reader the integration.
990990
*/
991+
/**
992+
* Dataverse declares a resource scope, but binding an environment swaps it for
993+
* that environment's `/.default`, so the rows alone claim a request the
994+
* runtime does not make.
995+
*/
996+
it('carries a service caveat the rows cannot state on their own', () => {
997+
const section = buildScopesSection('microsoft-dataverse', 'Microsoft Dataverse')
998+
999+
expect(section).toContain('`<environment-url>/.default`')
1000+
expect(buildScopesSection('sharepoint', 'SharePoint')).not.toContain('.default')
1001+
})
1002+
9911003
it('names the opt-in scopes in prose even though the table omits them', () => {
9921004
const section = buildScopesSection('slack', 'Slack')
9931005

scripts/generate-docs.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import { isVersionedType, stripVersionSuffix } from '@sim/utils/string'
77
import { glob } from 'glob'
88
import type { BlockCategory } from '../apps/sim/blocks/types'
99
import { IntegrationType } from '../apps/sim/blocks/types'
10-
import { ENV_GATED_SCOPES, getScopeDescription, OAUTH_SCOPES } from '../apps/sim/lib/oauth/scopes'
10+
import {
11+
ENV_GATED_SCOPES,
12+
getScopeDescription,
13+
OAUTH_SCOPES,
14+
SERVICE_SCOPE_NOTES,
15+
} from '../apps/sim/lib/oauth/scopes'
1116
import type { ToolOutputProperty } from '../apps/sim/tools/types'
1217

1318
/**
@@ -1516,12 +1521,20 @@ const SELF_HOSTING_GENERATED_END = '{/* GENERATED-END:oauth-apps */}'
15161521
* in prose keeps the page honest for the reader who does set the flag.
15171522
*/
15181523
function renderEnvGatedScopeNote(serviceId: string): string {
1524+
const notes: string[] = []
1525+
15191526
const gated = ENV_GATED_SCOPES[serviceId as keyof typeof ENV_GATED_SCOPES]
1520-
if (!gated) return ''
1521-
return (
1522-
`With \`${gated.envVar}\` set, Sim also requests ${renderScopeList(gated.scopes)}. ` +
1523-
`Add them to the app as well, or leave the flag unset.`
1524-
)
1527+
if (gated) {
1528+
notes.push(
1529+
`With \`${gated.envVar}\` set, Sim also requests ${renderScopeList(gated.scopes)}. ` +
1530+
`Add them to the app as well, or leave the flag unset.`
1531+
)
1532+
}
1533+
1534+
const caveat = SERVICE_SCOPE_NOTES[serviceId as keyof typeof SERVICE_SCOPE_NOTES]
1535+
if (caveat) notes.push(caveat)
1536+
1537+
return notes.join(' ')
15251538
}
15261539

15271540
const renderScopeList = (scopes: readonly string[]): string =>

0 commit comments

Comments
 (0)