mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
permissions: support workspace roots in profiles
This commit is contained in:
@@ -25,10 +25,25 @@ impl PermissionsToml {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
#[schemars(deny_unknown_fields)]
|
||||
pub struct PermissionProfileToml {
|
||||
pub workspace_roots: Option<WorkspaceRootsToml>,
|
||||
pub filesystem: Option<FilesystemPermissionsToml>,
|
||||
pub network: Option<NetworkToml>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
pub struct WorkspaceRootsToml {
|
||||
#[serde(flatten)]
|
||||
pub entries: BTreeMap<String, bool>,
|
||||
}
|
||||
|
||||
impl WorkspaceRootsToml {
|
||||
pub fn enabled_roots(&self) -> impl Iterator<Item = &String> {
|
||||
self.entries
|
||||
.iter()
|
||||
.filter_map(|(path, enabled)| (*enabled).then_some(path))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
pub struct FilesystemPermissionsToml {
|
||||
/// Optional maximum depth for expanding unreadable glob patterns on
|
||||
|
||||
Reference in New Issue
Block a user