pub struct CheckAccessRights {
pub database: String,
pub uid: OdooId,
pub password: String,
pub model: String,
pub operation: AccessOperation,
pub raise_exception: bool,
}
Expand description
Check model access rights (according to ir.model.access
)
This method checks against ir.model.access
, e.g. basic per-group CRUD rules.
You should also call CheckAccessRules
in order to determine if any advanced
access rules apply to this model/user.
Note: This method raises an API exception if the access rights check fails.
You probably want to specify raise_exception: false
, which will cause the
request to return false
when the check fails.
§Example
use odoo_api::service::orm::AccessOperation;
client.check_access_rights(
"stock.quant",
AccessOperation::Unlink,
false // raise_exception
).send()?;
// Quants are never deleteable, so this will return `false`
See: odoo/models.py
Fields§
§database: String
The database name (auto-filled by OdooClient
)
uid: OdooId
The user id (auto-filled by OdooClient
)
password: String
The user password (auto-filled by OdooClient
)
model: String
The Odoo model
operation: AccessOperation
The CRUD operation to check
raise_exception: bool
How should check failures be reported?
true
: An API exception is raised (catchable with?
, etc)false
: TheCheckAccessRightsResponse
ok
field will be set tofalse
Trait Implementations§
Source§impl Debug for CheckAccessRights
impl Debug for CheckAccessRights
Source§impl JsonRpcParams for CheckAccessRights
impl JsonRpcParams for CheckAccessRights
type Container<T> = OdooOrmContainer<CheckAccessRights>
type Response = CheckAccessRightsResponse
fn build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
Source§impl OdooOrmMethod for CheckAccessRights
impl OdooOrmMethod for CheckAccessRights
Source§fn endpoint(&self) -> &'static str
fn endpoint(&self) -> &'static str
Describe the “ORM” method endpoint (e.g., “/web/session/authenticate”)
Source§fn method(&self) -> &'static str
fn method(&self) -> &'static str
Return the model method name (e.g., “read_group” or “create”)
Source§fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
fn _build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
Build
self
into a full JsonRpcRequest
Auto Trait Implementations§
impl Freeze for CheckAccessRights
impl RefUnwindSafe for CheckAccessRights
impl Send for CheckAccessRights
impl Sync for CheckAccessRights
impl Unpin for CheckAccessRights
impl UnwindSafe for CheckAccessRights
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more