(&self)
| 161 | |
| 162 | impl UnauthorizedError { |
| 163 | pub fn detail(&self) -> Option<String> { |
| 164 | match &self { |
| 165 | UnauthorizedError::Superuser { action } => { |
| 166 | Some(format!("You must be a superuser to {}", action)) |
| 167 | } |
| 168 | UnauthorizedError::Privilege { |
| 169 | object_description, |
| 170 | role_name, |
| 171 | privileges, |
| 172 | } => Some(format!( |
| 173 | "The '{role_name}' role needs {privileges} privileges on {object_description}" |
| 174 | )), |
| 175 | UnauthorizedError::MzSystem { .. } => { |
| 176 | Some(format!("You must be the '{}' role", SYSTEM_USER.name)) |
| 177 | } |
| 178 | UnauthorizedError::MzSupport { .. } => Some(format!( |
| 179 | "The '{}' role has very limited privileges", |
| 180 | SUPPORT_USER.name |
| 181 | )), |
| 182 | UnauthorizedError::ConcurrentRoleDrop(_) => { |
| 183 | Some("Please disconnect and re-connect with a valid role.".into()) |
| 184 | } |
| 185 | UnauthorizedError::RestrictedSystemObject { .. } => Some( |
| 186 | "Access to system catalog objects is restricted for this role. \ |
| 187 | Contact your administrator if you need access." |
| 188 | .into(), |
| 189 | ), |
| 190 | UnauthorizedError::Ownership { .. } | UnauthorizedError::RoleMembership { .. } => None, |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | /// RBAC requirements for executing a given plan. |
no outgoing calls
no test coverage detected