LDAP Access Dropdown does not have a default value and results in a 500 error if no value is set when creating a group link
Summary
When creating an LDAP group link, the LDAP Access dropdown used to have a default value of Guest.
In more recent versions of GitLab (tested with 17.4.1 and above), the dropdown does not have a default value. If you click on Add Synchronization without selecting a role, you will receive a 500 error:
"exception.class": "ActiveRecord::NotNullViolation",
"exception.message": "PG::NotNullViolation: ERROR: null value in column \"group_access\" of relation \"ldap_group_links\" violates not-null constraint\nDETAIL: Failing row contains (7, gitlab-group-1, null, 2, 2024-12-10 10:27:03.131423, 2024-12-10 10:27:03.131423, ldapmain, null, null).\n",
2 files
This should be better handled in the UI instead of throwing an exception.
Steps to reproduce
- Configure LDAP group synchronization
- Click on
Add Synchronizationunder a Group's Settings > LDAP Synchronzation page without setting a value for LDAP Access - You will receive a 500 error and a
ActiveRecord::NotNullViolationexception will be present in the logs.
What is the current bug behavior?
500 Error is received when clicking on Add Synchronization
What is the expected correct behavior?
The LDAP Access Dropdown should have a default value like before, OR the POST request should not be completed and a message should be displayed in the UI that LDAP Access must be selected.
Relevant logs and/or screenshots
16.10 (LDAP Access Dropdown has default value):
17.4.1 (LDAP Access Dropdown DOES NOT have a default value):
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)

