feat: Start implementing roles (and domainless service users)
This commit is contained in:
parent
8c29f1d31f
commit
10548295cd
10 changed files with 156 additions and 21 deletions
|
|
@ -5,12 +5,18 @@ use crate::db::UserRef;
|
|||
pub type BoxedError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct UserAlreadyExists(pub UserRef);
|
||||
pub enum UserCreationError {
|
||||
UserAlreadyExists(UserRef),
|
||||
Permissions,
|
||||
}
|
||||
|
||||
impl fmt::Display for UserAlreadyExists {
|
||||
impl fmt::Display for UserCreationError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "User already exists: {}", self.0)
|
||||
match self {
|
||||
Self::UserAlreadyExists(user) => write!(f, "User already exists: {user}"),
|
||||
Self::Permissions => write!(f, "You do not have permissions to create this user"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for UserAlreadyExists {}
|
||||
impl std::error::Error for UserCreationError {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue