feat: add multi-user support and role-based access control #31

This commit is contained in:
rustmailer
2025-12-26 14:27:04 +08:00
parent 1e2f526a07
commit 4af5176b65
181 changed files with 23745 additions and 3187 deletions
+12 -2
View File
@@ -78,7 +78,13 @@ impl ImapConnectionManager {
})?;
let password = decrypt!(&password)?;
client.login(&username, &password).await
client.login(&username, &password).await.map_err(|e| {
error!(
"IMAP password auth failed for username '{}': {}",
username, e
);
e
})
}
AuthType::OAuth2 => {
let record = OAuth2AccessToken::get(self.account_id).await?;
@@ -90,8 +96,12 @@ impl ImapConnectionManager {
)
})?;
client
.authenticate(OAuth2::new(username, access_token))
.authenticate(OAuth2::new(username.clone(), access_token))
.await
.map_err(|e| {
error!("IMAP OAuth2 auth failed for username '{}': {}", username, e);
e
})
}
}
}
-1
View File
@@ -16,7 +16,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use crate::modules::error::code::ErrorCode;
use crate::modules::error::{BichonError, BichonResult};
use crate::modules::imap::{manager::ImapConnectionManager, session::SessionStream};