-
-
Notifications
You must be signed in to change notification settings - Fork 325
Add new OIDC users to default group #1105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ | |
| from app.business.auth import validate_ldap_login, _retrieve_user_by_username, wrap_login_user | ||
| from app.datamgmt.manage.manage_users_db import create_user | ||
| from app.datamgmt.manage.manage_users_db import get_user | ||
| from app.datamgmt.manage.manage_users_db import add_user_to_group | ||
| from app.datamgmt.manage.manage_groups_db import get_group_by_name | ||
| from app.forms import LoginForm, MFASetupForm | ||
| from app.iris_engine.utils.tracker import track_activity | ||
|
|
||
|
|
@@ -215,6 +217,10 @@ def oidc_authorise(): | |
| user_is_service_account=False | ||
| ) | ||
|
|
||
| initial_group = get_group_by_name(app.config.get('IRIS_NEW_USERS_DEFAULT_GROUP')) | ||
| add_user_to_group(user.id, initial_group.group_id) | ||
|
Comment on lines
+220
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Validate the configured group before dereferencing it. If 🤖 Prompt for AI Agents🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 20 'def create_user|def add_user_to_group|db\.session\.(commit|rollback)' source/appRepository: dfir-iris/iris-web Length of output: 50375 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== target file outline/sections =="
wc -l source/app/blueprints/pages/login/login_routes.py source/app/datamgmt/manage/manage_users_db.py || true
sed -n '180,250p' source/app/blueprints/pages/login/login_routes.py
printf '\n== manage_users_db relevant sections ==\n'
sed -n '240,355p' source/app/datamgmt/manage/manage_users_db.py
printf '\n== precise function definitions/callers/usages in relevant datamgmt files ==\n'
rg -n -C 12 'def create_user|def add_user_to_group|get_group_by_name|create_user\s*\(|add_user_to_group\s*\(' source/app/datamgmt/manage source/app/blueprints/pages/login/login_routes.py
printf '\n== db transaction declarations in relevant files ==\n'
rg -n 'db\.session\.(commit|rollback)|before_request|atexit|`@app`\.(teardown|before)|after_request|sessionmaker|scoped_session|transaction' source/app/datamgmt/manage/manage_users_db.py source/app/blueprints/pages/login/login_routes.pyRepository: dfir-iris/iris-web Length of output: 18844 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== create_user implementation =="
sed -n '673,730p' source/app/datamgmt/manage/manage_users_db.py
echo "== User.save definition candidates =="
rg -n -C 8 'class User|def save\(' source/app source -g '*.py' | head -n 120
echo "== OIDC login route full function =="
sed -n '130,230p' source/app/blueprints/pages/login/login_routes.py
echo "== search for session rollback handling in OIDC path =="
rg -n -C 6 'add_user_to_group|create_user\(|IRIS_NEW_USERS_DEFAULT_GROUP|db\.session\.rollback|rollback\(\)' source/app/blueprints/pages/login source/app/datamgmt -g '*.py'Repository: dfir-iris/iris-web Length of output: 23104 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== User save implementation =="
sed -n '199,250p' source/app/models/authorization.py
echo "== ac_auto_update_user_effective_access implementation =="
rg -n -C 12 'def ac_auto_update_user_effective_access|_auto_update_user_effective_access' source/app/datamgmt -g '*.py'Repository: dfir-iris/iris-web Length of output: 24376 Make OIDC user creation and default-group assignment atomic.
🤖 Prompt for AI Agents |
||
| log.info(f"Adding new user {user_name} to default initial group {initial_group}.") | ||
|
|
||
| if user and not user.active: | ||
| return response_error("User not active in IRIS", 403) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the authentication spelling.
The changed comment still uses
authentification. Replace it withauthentication.🤖 Prompt for AI Agents