Build a default trust-mode identity for a given username. Used by both explicit auth requests and auto-auth on first frame.
(state: &SharedState, username: &str)
| 124 | /// |
| 125 | /// Used by both explicit auth requests and auto-auth on first frame. |
| 126 | pub fn trust_identity(state: &SharedState, username: &str) -> AuthenticatedIdentity { |
| 127 | if let Some(id) = state.credentials.to_identity(username, AuthMethod::Trust) { |
| 128 | id |
| 129 | } else { |
| 130 | AuthenticatedIdentity { |
| 131 | user_id: 0, |
| 132 | username: username.to_string(), |
| 133 | tenant_id: TenantId::new(1), |
| 134 | auth_method: AuthMethod::Trust, |
| 135 | roles: vec![Role::Superuser], |
| 136 | is_superuser: true, |
| 137 | default_database: None, |
| 138 | accessible_databases: DatabaseSet::All, |
| 139 | } |
| 140 | } |
| 141 | } |
no test coverage detected