add: user secondary permission

This commit is contained in:
trisua 2025-06-23 19:42:02 -04:00
parent 339aa59434
commit 9528d71b2a
6 changed files with 128 additions and 95 deletions

View file

@ -3,6 +3,7 @@ use oiseau::cache::Cache;
use crate::model::auth::UserConnections;
use crate::model::moderation::AuditLogEntry;
use crate::model::oauth::AuthGrant;
use crate::model::permissions::SecondaryPermission;
use crate::model::{
Error, Result,
auth::{Token, User, UserSettings},
@ -46,6 +47,7 @@ impl DataManager {
grants: serde_json::from_str(&get!(x->19(String)).to_string()).unwrap(),
associated: serde_json::from_str(&get!(x->20(String)).to_string()).unwrap(),
invite_code: get!(x->21(i64)) as usize,
secondary_permissions: SecondaryPermission::from_bits(get!(x->7(i32)) as u32).unwrap(),
}
}
@ -224,7 +226,8 @@ impl DataManager {
&"",
&serde_json::to_string(&data.grants).unwrap(),
&serde_json::to_string(&data.associated).unwrap(),
&(data.invite_code as i64)
&(data.invite_code as i64),
&(SecondaryPermission::DEFAULT.bits() as i32),
]
);

View file

@ -19,5 +19,6 @@ CREATE TABLE IF NOT EXISTS users (
connections TEXT NOT NULL,
stripe_id TEXT NOT NULL,
grants TEXT NOT NULL,
associated TEXT NOT NULL
associated TEXT NOT NULL,
secondary_permissions INT NOT NULL
)