list_row_policies()
Lists the row-level security policies attached to a collection.
pub async fn list_row_policies(&self, request: ListRowPoliciesRequest) -> Result<ListRowPoliciesResponse>
The caller must hold the ViewRLS privilege on the collection.
Request Syntax
let request = ListRowPoliciesRequest::builder()
.collection_name("books")
.build()?;
REQUEST FIELDS:
database_name: Option<String>Name of the target database; uses the default database when empty.
collection_name: StringName of the collection whose policies are listed. Required.
RETURN TYPE:
Result
RETURNS:
A ListRowPoliciesResponse containing the policies and their target collection. Returns an Error if the operation fails.
ListRowPoliciesResponse
policies() // -> &[RowPolicy]
database_name() // -> &str
collection_name() // -> &str
METHODS:
policies()(&[RowPolicy]) -The row policies attached to the collection.
A row-level security policy attached to a collection, as returned by ListRowPolicies.
pub struct RowPolicyMETHODS:
get_policy_name()(&str) -The policy name.
get_actions()(&[RowPolicyAction]) -Operations governed by the policy. See RowPolicyAction.
get_using_expr()(&str) -Expression that filters readable rows.
get_check_expr()(&str) -Expression that checks writable rows.
get_description()(&str) -Policy description.
get_created_at()(i64) -Server creation timestamp;
0means unavailable.get_policy_type()(RowPolicyType) -Policy combination mode. See RowPolicyType.
database_name()(&str) -The database that contains the collection.
collection_name()(&str) -The collection whose policies were listed.
Example
let request = ListRowPoliciesRequest::builder()
.collection_name("books")
.build()?;
let resp = client.list_row_policies(request).await?;
println!("policy count: {}", resp.policies().len());