block adding users over license limits in openid and ldap#2104
Open
filipslezaklab wants to merge 7 commits intodevfrom
Open
block adding users over license limits in openid and ldap#2104filipslezaklab wants to merge 7 commits intodevfrom
filipslezaklab wants to merge 7 commits intodevfrom
Conversation
openid limits tests block adding excess users via openid sync and login
moubctez
reviewed
Feb 23, 2026
| let pool = setup_pool(options).await; | ||
|
|
||
| let config = DefGuardConfig::new_test_config(); | ||
| let _ = SERVER_CONFIG.set(config.clone()); |
Contributor
There was a problem hiding this comment.
Probably clone() is not needed.
moubctez
reviewed
Feb 23, 2026
|
|
||
| if let Some((user_count, limit)) = reached_user_license_limit() { | ||
| error!( | ||
| "Skipping OpenID account creation for user {} (email: {}) because \ |
Contributor
There was a problem hiding this comment.
Embed variables in formatting string.
moubctez
reviewed
Feb 23, 2026
| if let Some(limit) = user_limit.filter(|limit| user_count >= *limit) { | ||
| error!( | ||
| "Skipping LDAP import of user {} (email: {}) because license user limit \ | ||
| has been reached ({}/{})", |
Contributor
There was a problem hiding this comment.
Suggested change
| has been reached ({}/{})", | |
| has been reached ({user_count}/{limit})", |
moubctez
reviewed
Feb 23, 2026
| if let Some((user_count, limit)) = reached_user_license_limit() { | ||
| error!( | ||
| "Skipping LDAP account creation for user {} (email: {}) because license user \ | ||
| limit has been reached ({}/{})", |
Contributor
There was a problem hiding this comment.
Suggested change
| limit has been reached ({}/{})", | |
| limit has been reached ({user_count}/{limit})", |
moubctez
reviewed
Feb 23, 2026
| pub async fn get_admins_emails(pool: &PgPool) -> Result<Vec<String>, sqlx::Error> { | ||
| debug!("Getting emails of active admins"); | ||
| query_scalar::<_, String>( | ||
| " |
Contributor
There was a problem hiding this comment.
SELECT u.email FROM "user" u JOIN group_user gu ON gu.user_id = u.id JOIN "group" g ON gu.group_id = g.id WHERE g.is_admin;
moubctez
reviewed
Feb 23, 2026
| @@ -0,0 +1,3 @@ | |||
| INSERT INTO mail_context (template, section, language_tag, text) VALUES | |||
Contributor
There was a problem hiding this comment.
Rename migration to [2.0.0]…
moubctez
reviewed
Feb 23, 2026
| @@ -0,0 +1 @@ | |||
| v25 | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openid limits tests
block adding excess users via openid sync and login
send simple (placeholder) emails notifying active admins of the blocking.
Related #2004