(
scx: &StatementContext,
privileges: PrivilegeSpecification,
target: GrantTargetSpecification<Aug>,
roles: Vec<ResolvedRoleName>,
)
| 420 | } |
| 421 | |
| 422 | fn plan_update_privilege( |
| 423 | scx: &StatementContext, |
| 424 | privileges: PrivilegeSpecification, |
| 425 | target: GrantTargetSpecification<Aug>, |
| 426 | roles: Vec<ResolvedRoleName>, |
| 427 | ) -> Result<UpdatePrivilegesPlan, PlanError> { |
| 428 | let (object_type, target_ids) = match target { |
| 429 | GrantTargetSpecification::Object { |
| 430 | object_type, |
| 431 | object_spec_inner, |
| 432 | } => { |
| 433 | fn object_type_filter( |
| 434 | object_id: &ObjectId, |
| 435 | object_type: &ObjectType, |
| 436 | scx: &StatementContext, |
| 437 | ) -> bool { |
| 438 | if object_type == &ObjectType::Table { |
| 439 | scx.get_object_type(object_id).is_relation() |
| 440 | } else { |
| 441 | object_type == &scx.get_object_type(object_id) |
| 442 | } |
| 443 | } |
| 444 | let object_type = object_type.into(); |
| 445 | let object_ids: Vec<ObjectId> = match object_spec_inner { |
| 446 | GrantTargetSpecificationInner::All(GrantTargetAllSpecification::All) => { |
| 447 | let cluster_ids = scx |
| 448 | .catalog |
| 449 | .get_clusters() |
| 450 | .into_iter() |
| 451 | .map(|cluster| cluster.id().into()); |
| 452 | let database_ids = scx |
| 453 | .catalog |
| 454 | .get_databases() |
| 455 | .into_iter() |
| 456 | .map(|database| database.id().into()); |
| 457 | let schema_ids = scx |
| 458 | .catalog |
| 459 | .get_schemas() |
| 460 | .into_iter() |
| 461 | .filter(|schema| !schema.id().is_temporary()) |
| 462 | .map(|schema| (schema.database().clone(), schema.id().clone()).into()); |
| 463 | let item_ids = scx |
| 464 | .catalog |
| 465 | .get_items() |
| 466 | .into_iter() |
| 467 | .map(|item| item.id().into()); |
| 468 | cluster_ids |
| 469 | .chain(database_ids) |
| 470 | .chain(schema_ids) |
| 471 | .chain(item_ids) |
| 472 | .filter(|object_id| object_type_filter(object_id, &object_type, scx)) |
| 473 | .filter(|object_id| object_id.is_user()) |
| 474 | .collect() |
| 475 | } |
| 476 | GrantTargetSpecificationInner::All(GrantTargetAllSpecification::AllDatabases { |
| 477 | databases, |
| 478 | }) => { |
| 479 | let schema_ids = databases |
no test coverage detected