pub struct AdminService<S> { /* private fields */ }Expand description
Admin service — privileged operations.
Callers are responsible for verifying that the acting identity has admin privileges before calling any method.
Implementations§
Source§impl<S> AdminService<S>where
S: UserRepository + SessionRepository + OrgRepository + AuditLogRepository + Clone + Send + Sync + 'static,
impl<S> AdminService<S>where
S: UserRepository + SessionRepository + OrgRepository + AuditLogRepository + Clone + Send + Sync + 'static,
pub fn new(storage: S, events: EventBus, session_ttl_secs: i64) -> Self
Sourcepub fn storage(&self) -> &S
pub fn storage(&self) -> &S
Internal accessor used by the dashboard for advanced admin operations.
Sourcepub async fn list_users(&self, offset: u32, limit: u32) -> Result<Vec<User>>
pub async fn list_users(&self, offset: u32, limit: u32) -> Result<Vec<User>>
Paginated list of all users ordered by created_at.
Sourcepub async fn create_user(&self, admin_id: Uuid, email: String) -> Result<User>
pub async fn create_user(&self, admin_id: Uuid, email: String) -> Result<User>
Create a user directly (admin provisioning). Does not require an email-password credential.
Sourcepub async fn set_role(
&self,
admin_id: Uuid,
org_id: Uuid,
user_id: Uuid,
role_id: Uuid,
) -> Result<Membership>
pub async fn set_role( &self, admin_id: Uuid, org_id: Uuid, user_id: Uuid, role_id: Uuid, ) -> Result<Membership>
Assign a role to an org member.
Sourcepub async fn ban_user(
&self,
admin_id: Uuid,
user_id: Uuid,
reason: &str,
) -> Result<()>
pub async fn ban_user( &self, admin_id: Uuid, user_id: Uuid, reason: &str, ) -> Result<()>
Soft-ban a user by marking metadata {"banned": true}.
pub async fn ban_status(&self, user_id: Uuid) -> Result<BanStatus>
Sourcepub async fn impersonate(
&self,
admin_id: Uuid,
target_id: Uuid,
admin_ip: &str,
) -> Result<(Session, String)>
pub async fn impersonate( &self, admin_id: Uuid, target_id: Uuid, admin_ip: &str, ) -> Result<(Session, String)>
Create an impersonation session for target_user_id.
pub async fn list_sessions(&self, user_id: Uuid) -> Result<Vec<Session>>
pub async fn revoke_all_sessions( &self, admin_id: Uuid, user_id: Uuid, ) -> Result<()>
Auto Trait Implementations§
impl<S> Freeze for AdminService<S>where
S: Freeze,
impl<S> !RefUnwindSafe for AdminService<S>
impl<S> Send for AdminService<S>where
S: Send,
impl<S> Sync for AdminService<S>where
S: Sync,
impl<S> Unpin for AdminService<S>where
S: Unpin,
impl<S> UnsafeUnpin for AdminService<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for AdminService<S>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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