mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Implement federated login; #123
This commit is contained in:
1 parent
6601c188d0
commit
2adf8249bb
35 files changed
+1466
-121
No files matched your search
@@ -0,0 +1,29 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "federations")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub creation_time: i64, // seconds since unix epoch
|
||||
pub last_used_time: i64, // seconds since unix epoch
|
||||
pub domain: String, // root domain
|
||||
pub auth: String,
|
||||
pub cdn: String,
|
||||
pub factory: String,
|
||||
pub society: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::user::Entity")]
|
||||
User,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -15,6 +15,7 @@ pub mod factory;
|
||||
pub mod friend;
|
||||
pub mod clan;
|
||||
pub mod clan_member;
|
||||
pub mod federation;
|
||||
|
||||
pub fn parse_int_csv(s: &str) -> Vec<u32> {
|
||||
s.split(',').filter_map(|i_as_s| {
|
||||
|
||||
@@ -11,6 +11,7 @@ pub struct Model {
|
||||
pub password: String,
|
||||
pub email: String,
|
||||
pub steam_id: Option<String>, // u64
|
||||
pub federation_id: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
@@ -29,6 +30,12 @@ pub enum Relation {
|
||||
FactoryUploads,
|
||||
#[sea_orm(has_many = "super::friend::Entity")]
|
||||
Friends, // this will probably join the wrong column (i.e. in the wrong direction)
|
||||
#[sea_orm(
|
||||
belongs_to = "super::federation::Entity",
|
||||
from = "Column::FederationId",
|
||||
to = "super::federation::Column::Id"
|
||||
)]
|
||||
Federation,
|
||||
}
|
||||
|
||||
impl Related<super::permissions::Entity> for Entity {
|
||||
@@ -73,4 +80,10 @@ impl Related<super::friend::Entity> for Entity {
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::federation::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Federation.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in new issue
Block a user