import json
import os
from parable_types_web_api import SetSourcePermissionsInput
from parable_web_api_sdk import ClientConfig, WebApiSDK
sdk = WebApiSDK(
ClientConfig(
base_url=os.environ["PARABLE_API_URL"],
auth_token=os.environ["PARABLE_API_TOKEN"],
default_headers={"X-Tenant": os.environ["PARABLE_WORKSPACE"]},
)
)
input_data = SetSourcePermissionsInput.model_validate(
json.loads("{\"expectedRevision\":1,\"enforced\":true,\"linkOnlyGrantsAdmit\":true,\"unmodeledTablesAdmit\":true}"),
)
result = sdk.provider_policies.set_source_permissions(input_data)sdk, err := webapisdk.New(webapisdk.SDKConfig{
BaseURL: os.Getenv("PARABLE_API_URL"),
Auth: &webapisdk.AuthConfig{Token: os.Getenv("PARABLE_API_TOKEN")},
RequestInterceptor: func(ctx context.Context, req *http.Request) error {
req.Header.Set("X-Tenant", os.Getenv("PARABLE_WORKSPACE"))
return nil
},
})
if err != nil {
return err
}
var input webapitypes.SetSourcePermissionsInput
if err := json.Unmarshal([]byte(`{"expectedRevision":1,"enforced":true,"linkOnlyGrantsAdmit":true,"unmodeledTablesAdmit":true}`), &input); err != nil {
return err
}
result, err := sdk.ProviderPoliciesNamespace.SetSourcePermissions(ctx, input){
"data": {
"canManage": true,
"enforced": true,
"linkOnlyGrantsAdmit": true,
"managerReadSources": [
{
"connectorId": "<string>",
"name": "<string>",
"slug": "<string>"
}
],
"revision": 0,
"unmodeledTablesAdmit": true,
"managerReads": {
"confirmedAt": "2023-11-07T05:31:56Z",
"confirmedBy": "<string>",
"connectorId": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
},
"meta": {
"requestId": "<string>",
"totalCount": 123
},
"links": {
"first": "<string>",
"last": "<string>",
"next": "<string>",
"prev": "<string>"
}
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}Too Many Requests{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}Set the Workspace's source permissions settings
Replaces the selected Workspace’s source permissions settings: whether source permissions are enforced, whether link-only grants admit their audience, and whether a table with no permission model reads all rows or no rows. With enforcement on, a table a connector models, with no Provider Policy, reads only the rows each reader may open in the source. A table with no model reads all rows, or, with unmodeledTablesAdmit false, no rows for each reader that source permissions bind, whatever a Provider Policy gives them. All data access still reads every row. The save is refused unless expectedRevision is the current revision. A change is kept in the settings’ history and recorded in the audit trail with the person and the old and new values. A save that changes nothing records nothing.
import json
import os
from parable_types_web_api import SetSourcePermissionsInput
from parable_web_api_sdk import ClientConfig, WebApiSDK
sdk = WebApiSDK(
ClientConfig(
base_url=os.environ["PARABLE_API_URL"],
auth_token=os.environ["PARABLE_API_TOKEN"],
default_headers={"X-Tenant": os.environ["PARABLE_WORKSPACE"]},
)
)
input_data = SetSourcePermissionsInput.model_validate(
json.loads("{\"expectedRevision\":1,\"enforced\":true,\"linkOnlyGrantsAdmit\":true,\"unmodeledTablesAdmit\":true}"),
)
result = sdk.provider_policies.set_source_permissions(input_data)sdk, err := webapisdk.New(webapisdk.SDKConfig{
BaseURL: os.Getenv("PARABLE_API_URL"),
Auth: &webapisdk.AuthConfig{Token: os.Getenv("PARABLE_API_TOKEN")},
RequestInterceptor: func(ctx context.Context, req *http.Request) error {
req.Header.Set("X-Tenant", os.Getenv("PARABLE_WORKSPACE"))
return nil
},
})
if err != nil {
return err
}
var input webapitypes.SetSourcePermissionsInput
if err := json.Unmarshal([]byte(`{"expectedRevision":1,"enforced":true,"linkOnlyGrantsAdmit":true,"unmodeledTablesAdmit":true}`), &input); err != nil {
return err
}
result, err := sdk.ProviderPoliciesNamespace.SetSourcePermissions(ctx, input){
"data": {
"canManage": true,
"enforced": true,
"linkOnlyGrantsAdmit": true,
"managerReadSources": [
{
"connectorId": "<string>",
"name": "<string>",
"slug": "<string>"
}
],
"revision": 0,
"unmodeledTablesAdmit": true,
"managerReads": {
"confirmedAt": "2023-11-07T05:31:56Z",
"confirmedBy": "<string>",
"connectorId": "<string>"
},
"updatedAt": "2023-11-07T05:31:56Z",
"updatedBy": "<string>"
},
"meta": {
"requestId": "<string>",
"totalCount": 123
},
"links": {
"first": "<string>",
"last": "<string>",
"next": "<string>",
"prev": "<string>"
}
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}Too Many Requests{
"detail": "<string>",
"status": 400,
"title": "Bad Request",
"type": "about:blank",
"code": "WA-VL-001",
"details": "<unknown>",
"errors": "<unknown>",
"requestId": "<string>"
}Access
This operation needs a Parable token. An MCP token cannot call it. See Authentication for the kinds of token. Your roles must granttenant.providerpolicies.manage.
Errors
WA-PP-009: Someone changed the Workspace’s source permissions settings after the revision the save names. Load the settings again and make the change on top of them.
Authorizations
Headers
Body
Replaces a Workspace's source permissions settings. Every setting is required: a save that leaves one out is refused rather than turning it off or on.
Response
Successful response