Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions apps/skit/src/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,28 +436,13 @@ impl PermissionsConfig {
)
}

/// Get the default role permissions
#[allow(dead_code)]
pub fn get_default(&self) -> Permissions {
self.get_role(&self.default_role)
}

/// Check if we can accept a new session (global limit check)
pub const fn can_accept_session(&self, current_count: usize) -> bool {
match self.max_concurrent_sessions {
None => true,
Some(max) => current_count < max,
}
}

/// Check if we can accept a new oneshot pipeline (global limit check)
#[allow(dead_code)]
pub const fn can_accept_oneshot(&self, current_count: usize) -> bool {
match self.max_concurrent_oneshots {
None => true,
Some(max) => current_count < max,
}
}
}

#[cfg(test)]
Expand Down Expand Up @@ -544,15 +529,6 @@ mod tests {
assert!(!config.can_accept_session(11));
}

#[test]
fn test_global_oneshot_limits() {
let config = PermissionsConfig { max_concurrent_oneshots: Some(5), ..Default::default() };

assert!(config.can_accept_oneshot(0));
assert!(config.can_accept_oneshot(4));
assert!(!config.can_accept_oneshot(5));
}

#[test]
fn test_user_role_defaults() {
let user = Permissions::user();
Expand Down
Loading