Add check for LDAP group membership (#10869)

This is a port of gogs/gogs#4398

The only changes made by myself are:

Add locales
Add some JS to the UI
Otherwise all code credit goes to @aboron

Resolves #10829

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
John Olheiser 2020-09-10 10:30:07 -05:00 committed by GitHub
parent 4c42fce401
commit c3e8c9441a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 173 additions and 2 deletions

View file

@ -1795,6 +1795,14 @@ function initAdmin() {
}
}
function onVerifyGroupMembershipChange() {
if ($('#groups_enabled').is(':checked')) {
$('#groups_enabled_change').show();
} else {
$('#groups_enabled_change').hide();
}
}
// New authentication
if ($('.admin.new.authentication').length > 0) {
$('#auth_type').on('change', function () {
@ -1835,6 +1843,7 @@ function initAdmin() {
}
if (authType === '2' || authType === '5') {
onSecurityProtocolChange();
onVerifyGroupMembershipChange();
}
if (authType === '2') {
onUsePagedSearchChange();
@ -1845,12 +1854,15 @@ function initAdmin() {
$('#use_paged_search').on('change', onUsePagedSearchChange);
$('#oauth2_provider').on('change', onOAuth2Change);
$('#oauth2_use_custom_url').on('change', onOAuth2UseCustomURLChange);
$('#groups_enabled').on('change', onVerifyGroupMembershipChange);
}
// Edit authentication
if ($('.admin.edit.authentication').length > 0) {
const authType = $('#auth_type').val();
if (authType === '2' || authType === '5') {
$('#security_protocol').on('change', onSecurityProtocolChange);
$('#groups_enabled').on('change', onVerifyGroupMembershipChange);
onVerifyGroupMembershipChange();
if (authType === '2') {
$('#use_paged_search').on('change', onUsePagedSearchChange);
}