mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 23:07:54 +00:00
feat(api): add internal auth
This commit is contained in:
parent
9c1acd84e1
commit
dd14e7daef
3 changed files with 30 additions and 3 deletions
|
|
@ -7,11 +7,16 @@ pub const INTERNAL_APPID_HEADER: &'static str = "x-pluralkit-appid";
|
|||
pub struct AuthState {
|
||||
system_id: Option<i32>,
|
||||
app_id: Option<i32>,
|
||||
internal: bool,
|
||||
}
|
||||
|
||||
impl AuthState {
|
||||
pub fn new(system_id: Option<i32>, app_id: Option<i32>) -> Self {
|
||||
Self { system_id, app_id }
|
||||
pub fn new(system_id: Option<i32>, app_id: Option<i32>, internal: bool) -> Self {
|
||||
Self {
|
||||
system_id,
|
||||
app_id,
|
||||
internal,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn system_id(&self) -> Option<i32> {
|
||||
|
|
@ -22,6 +27,10 @@ impl AuthState {
|
|||
self.app_id
|
||||
}
|
||||
|
||||
pub fn internal(&self) -> bool {
|
||||
self.internal
|
||||
}
|
||||
|
||||
pub fn access_level_for(&self, a: &impl Authable) -> PrivacyLevel {
|
||||
if self
|
||||
.system_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue