diff --git a/modules/auth/auth_form.go b/modules/auth/auth_form.go index 7c452bbc3..8fe07d073 100644 --- a/modules/auth/auth_form.go +++ b/modules/auth/auth_form.go @@ -25,6 +25,8 @@ type AuthenticationForm struct { AttributeSurname string AttributeMail string AttributesInBind bool + UsePagedSearch bool + SearchPageSize int Filter string AdminFilter string IsActive bool diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go index bb69f3558..2e2db004f 100644 --- a/modules/auth/ldap/ldap.go +++ b/modules/auth/ldap/ldap.go @@ -42,6 +42,7 @@ type Source struct { AttributeSurname string // Surname attribute AttributeMail string // E-mail attribute AttributesInBind bool // fetch attributes in bind context (not user) + SearchPageSize uint32 // Search with paging page size Filter string // Query filter to validate entry AdminFilter string // Query filter to check if user is admin Enabled bool // if this source is disabled @@ -269,6 +270,11 @@ func (ls *Source) SearchEntry(name, passwd string, directBind bool) *SearchResul } } +// UsePagedSearch returns if need to use paged search +func (ls *Source) UsePagedSearch() bool { + return ls.SearchPageSize > 0 +} + // SearchEntries : search an LDAP source for all users matching userFilter func (ls *Source) SearchEntries() []*SearchResult { l, err := dial(ls) @@ -298,7 +304,12 @@ func (ls *Source) SearchEntries() []*SearchResult { []string{ls.AttributeUsername, ls.AttributeName, ls.AttributeSurname, ls.AttributeMail}, nil) - sr, err := l.Search(search) + var sr *ldap.SearchResult + if ls.UsePagedSearch() { + sr, err = l.SearchWithPaging(search, ls.SearchPageSize) + } else { + sr, err = l.Search(search) + } if err != nil { log.Error(4, "LDAP Search failed unexpectedly! (%v)", err) return nil diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 8a8e206b9..bf6ecbee1 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1379,6 +1379,8 @@ auths.attribute_name = First Name Attribute auths.attribute_surname = Surname Attribute auths.attribute_mail = Email Attribute auths.attributes_in_bind = Fetch Attributes in Bind DN Context +auths.use_paged_search = Use paged search +auths.search_page_size = Page size auths.filter = User Filter auths.admin_filter = Admin Filter auths.ms_ad_sa = MS AD Search Attributes diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 3e3212297..fb575961d 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -13,6 +13,7 @@ page=ページ template=テンプレート language=言語 notifications=通知 +create_new=作成… signed_in_as=ログイン済み username=ユーザ名 @@ -70,10 +71,12 @@ save_config_failed=設定ファイルの保存に失敗しました: %v password_holder=パスワード switch_dashboard_context=ダッシュ ボードのコンテキストを切替 my_repos=自分のリポジトリ +show_more_repos=リポジトリをさらに表示… collaborative_repos=共同リポジトリ my_orgs=自分の組織 my_mirrors=自分のミラー view_home=ビュー %s +search_repos=リポジトリを探す… issues.in_your_repos=あなたのリポジトリ @@ -82,6 +85,7 @@ repos=リポジトリ users=ユーザー organizations=組織 search=検索 +code=コード [auth] register_helper_msg=既にアカウントをお持ちですか?今すぐログインしましょう! @@ -306,14 +310,17 @@ file_permalink=パーマリンク stored_lfs=Git LFSで保管されています editor.preview_changes=変更をプレビュー +editor.name_your_file=ファイル名を指定… editor.or=または editor.commit_changes=変更をコミット editor.add_tmpl='%s/' を追加 editor.add='%s' を追加 editor.update='%s' を更新 editor.delete='%s' を削除 +editor.commit_message_desc=詳細な説明を追加… editor.commit_directly_to_this_branch=ブランチ%sへ直接コミットする。 editor.create_new_branch=新しいブランチにコミットしてプルリクエストを作成する。 +editor.new_branch_name_desc=新しいブランチ名… editor.cancel=キャンセル editor.branch_already_exists=ブランチ '%s' は、このリポジトリに既に存在します。 editor.no_changes_to_show=表示する変更箇所はありません。 @@ -409,6 +416,7 @@ issues.edit=編集 issues.cancel=キャンセル issues.save=保存 issues.label_title=ラベル名 +issues.label_description=ラベルの詳細 issues.label_color=ラベルの色 issues.label_count=%d ラベル issues.label_open_issues=%d 未解決の問題 @@ -417,6 +425,7 @@ issues.label_delete=削除 issues.label.filter_sort.alphabetically=アルファベット順 issues.label.filter_sort.reverse_alphabetically=逆アルファベット順 issues.label.filter_sort.by_size=サイズ +issues.label.filter_sort.reverse_by_size=サイズの逆順 issues.num_participants=参加者数 %d issues.attachment.open_tab=`クリックして新しいタブで "%s" を見る` issues.attachment.download=`クリックして "%s" をダウンロード` @@ -549,6 +558,7 @@ settings.transfer=オーナー移転 settings.delete=このリポジトリを削除 settings.delete_notices_1=-この操作は元に戻せません 。 settings.transfer_owner=新しいオーナー +settings.search_user_placeholder=ユーザーを検索… settings.add_webhook=Webhook を追加 settings.webhook.test_delivery=テスト配信 settings.webhook.request=リクエスト @@ -586,6 +596,7 @@ settings.protected_branch_can_push_yes=プッシュできます settings.protected_branch_can_push_no=プッシュできません settings.add_protected_branch=保護を有効にする settings.delete_protected_branch=保護を無効にする +settings.choose_branch=ブランチを選択… diff.browse_source=ソースを参照 diff.parent=親 @@ -614,6 +625,7 @@ release.title=タイトル release.content=コンテント release.write=書込み release.preview=プレビュー +release.loading=読み込み中… release.cancel=キャンセル release.publish=リリースを発行 release.save_draft=下書きを保存 @@ -638,6 +650,8 @@ people=人々 teams=チーム lower_members=メンバー lower_repositories=リポジトリ +create_new_team=新しいチーム +create_team=チームを作成 org_desc=説明 team_name=チーム名 team_desc=説明 @@ -674,6 +688,7 @@ teams.update_settings=設定の更新 teams.add_team_member=チーム メンバーを追加 teams.delete_team_success=このチームが削除されました。 teams.repositories=チームのリポジトリ +teams.search_repo_placeholder=リポジトリを検索… teams.add_team_repository=チームのリポジトリを追加 teams.remove_repo=削除(Remove) teams.add_nonexistent_repo=追加しようとしているリポジトリは存在しません。まずはじめに作成してください。 @@ -696,7 +711,10 @@ dashboard.clean_unbind_oauth=関連付けられていないOAuth接続を削除 dashboard.clean_unbind_oauth_success=すべての関連付けられていないOAuth接続は削除されました。 dashboard.delete_inactivate_accounts=非アクティブのアカウントをすべて削除 dashboard.delete_inactivate_accounts_success=すべての非アクティブなアカウントは削除されました。 +dashboard.reinit_missing_repos=レコードが存在するが見当たらないすべてのGitリポジトリを再初期化する +dashboard.reinit_missing_repos_success=レコードが存在するが見当たらないすべてのGitリポジトリが再初期化されました。 dashboard.sync_external_users=外部ユーザーデータの同期 +dashboard.git_fsck=全てのリポジトリでヘルスチェックを実行する dashboard.server_uptime=サーバーの稼働時間 dashboard.current_goroutine=現在のGoroutine dashboard.current_memory_usage=現在のメモリ使用量 @@ -745,6 +763,7 @@ repos.private=プライベート repos.watches=ウォッチ repos.stars=お気に入り repos.issues=課題 +repos.size=サイズ auths.name=名前 auths.type=タイプ diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index d297a94a5..a6e3492e2 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -95,7 +95,6 @@ mailer_user=SMTP Ім'я кристувача mailer_password=SMTP Пароль mail_notify=Дозволити поштові повідомлення disable_gravatar=Вимкнути Gravatar -federated_avatar_lookup=Увімкнути зовнішні аватари federated_avatar_lookup_popup=Увімкнути зовнішний Аватар за допомогою Libravatar. openid_signin=Увімкнути реєстрацію за допомогою OpenID enable_captcha=Увімкнути CAPTCHA @@ -261,6 +260,7 @@ new_password=Новий пароль retype_new_password=Введіть новий пароль ще раз emails=Адреса електронної пошти +manage_emails=Керування адресами ел. пошти email_desc=Ваша основна адреса електронної пошти використовуватиметься для сповіщення та інших операцій. primary=Основний delete_email=Видалити @@ -371,9 +371,9 @@ stored_lfs=Збережено з Git LFS editor.new_file=Новий файл editor.upload_file=Завантажити файл -editor.edit_file=Редагувати файл +editor.edit_file=Редагування файлу editor.preview_changes=Попередній перегляд змін -editor.edit_this_file=Редагування файла +editor.edit_this_file=Редагувати файл editor.delete_this_file=Видалити файл editor.name_your_file=Дайте назву файлу… editor.or=або @@ -383,6 +383,7 @@ editor.add_tmpl=Додати '%s/' editor.add=Додати '%s' editor.update=Оновити '%s' editor.delete=Видалити '%s' +editor.create_new_branch=Створити нову гілку для цього коміту та відкрити запит на злиття. editor.new_branch_name_desc=Нова назва гілки… editor.cancel=Відміна editor.branch_already_exists=Гілка '%s' вже присутня в репозиторії. @@ -527,6 +528,7 @@ milestones.modify=Оновити етап wiki=Wiki wiki.welcome=Ласкаво просимо до Wiki. +wiki.create_first_page=Створити першу сторінку wiki.page=Сторінка wiki.filter_page=Фільтр сторінок wiki.new_page=Сторінка @@ -547,18 +549,31 @@ activity.overview=Огляд activity.active_prs_count_n=%d Активні запити на злиття activity.merged_prs_count_1=Злитий запит на злиття activity.merged_prs_count_n=Злиті запити на злиття +activity.opened_prs_count_1=Запропонований запит на злиття +activity.opened_prs_count_n=Запропонованих запитів на злиття +activity.title.user_1=%d користувач +activity.title.user_n=%d користувачів +activity.title.prs_1=%d Запит на злиття +activity.title.prs_n=%d Запитів на злиття +activity.title.prs_opened_by=%s запропоновано %s activity.merged_prs_label=Злито +activity.opened_prs_label=Запропоновано activity.active_issues_count_1=%d Активна проблема activity.active_issues_count_n=%d Активні проблеми activity.closed_issues_count_1=Закрита проблема activity.closed_issues_count_n=Закриті проблеми activity.title.issues_1=%d Проблема activity.title.issues_n=%d Проблеми +activity.title.issues_closed_by=%s закрито %s +activity.title.issues_created_by=%s створено %s activity.closed_issue_label=Закриті activity.new_issues_count_1=Нова Проблема activity.new_issues_count_n=%d Проблем activity.new_issue_label=Відкриті activity.unresolved_conv_label=Відкрити +activity.title.releases_1=%d Реліз +activity.title.releases_n=%d Релізів +activity.title.releases_published_by=%s Опубліковано %s activity.published_release_label=Опубліковано search=Пошук @@ -612,9 +627,11 @@ settings.discord_username=Ім'я кристувача settings.discord_icon_url=URL іконки settings.slack_color=Колір settings.event_create=Створити +settings.event_create_desc=Гілку або тег створено. settings.event_pull_request=Запити до злиття settings.event_push=Push settings.event_repository=Репозиторій +settings.event_repository_desc=Репозиторій створений або видалено. settings.update_webhook=Оновити веб-хук settings.hook_type=Тип хука settings.slack_token=Токен @@ -630,6 +647,7 @@ settings.protected_branch=Захист гілки settings.protected_branch_can_push=Дозволити push? settings.protected_branch_can_push_yes=Ви можете виконувати push settings.protected_branch_can_push_no=Ви не можете виконувати push +settings.protect_whitelist_search_users=Пошук користувачів… settings.add_protected_branch=Увімкнути захист settings.delete_protected_branch=Вимкнути захист settings.choose_branch=Оберіть гілку… @@ -666,13 +684,16 @@ release.downloads=Завантажити branch.delete_head=Видалити branch.delete=Видалити гілку '%s' branch.delete_html=Видалити гілку +branch.create_from=з '%s' branch.deleted_by=Видалено %s +topic.manage_topics=Керувати тематичними мітками topic.done=Готово [org] org_name_holder=Назва організації org_full_name_holder=Повна назва організації +create_org=Створити організацію repo_updated=Оновлено people=Учасники teams=Команди @@ -882,6 +903,7 @@ commit_repo=запушено до %[3]s у %s#%[2]s` close_issue=`закрито проблему %s#%[2]s` reopen_issue=`повторно відкрито проблему %s#%[2]s` +create_pull_request=`створено запити на злиття %s#%[2]s` reopen_pull_request=`повторно відкрито запит на злиття %s#%[2]s` comment_issue=`відкоментовано проблему %s#%[2]s` merge_pull_request=`запит на злиття злито %s#%[2]s` diff --git a/public/js/index.js b/public/js/index.js index 5ea1e5f91..1594ab6d0 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1138,6 +1138,16 @@ function initAdmin() { } } + function onUsePagedSearchChange() { + if ($('#use_paged_search').prop('checked')) { + $('.search-page-size').show() + .find('input').attr('required', 'required'); + } else { + $('.search-page-size').hide() + .find('input').removeAttr('required'); + } + } + function onOAuth2Change() { $('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide(); $('.open_id_connect_auto_discovery_url input[required]').removeAttr('required'); @@ -1191,7 +1201,7 @@ function initAdmin() { // New authentication if ($('.admin.new.authentication').length > 0) { $('#auth_type').change(function () { - $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls').hide(); + $('.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls .search-page-size').hide(); $('.ldap input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required]').removeAttr('required'); @@ -1223,9 +1233,13 @@ function initAdmin() { if (authType == '2' || authType == '5') { onSecurityProtocolChange() } + if (authType == '2') { + onUsePagedSearchChange(); + } }); $('#auth_type').change(); $('#security_protocol').change(onSecurityProtocolChange); + $('#use_paged_search').change(onUsePagedSearchChange); $('#oauth2_provider').change(onOAuth2Change); $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange); } @@ -1234,6 +1248,9 @@ function initAdmin() { var authType = $('#auth_type').val(); if (authType == '2' || authType == '5') { $('#security_protocol').change(onSecurityProtocolChange); + if (authType == '2') { + $('#use_paged_search').change(onUsePagedSearchChange); + } } else if (authType == '6') { $('#oauth2_provider').change(onOAuth2Change); $('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange); diff --git a/routers/admin/auths.go b/routers/admin/auths.go index 3915c618b..6f142d797 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -91,6 +91,10 @@ func NewAuthSource(ctx *context.Context) { } func parseLDAPConfig(form auth.AuthenticationForm) *models.LDAPConfig { + var pageSize uint32 + if form.UsePagedSearch { + pageSize = uint32(form.SearchPageSize) + } return &models.LDAPConfig{ Source: &ldap.Source{ Name: form.Name, @@ -107,6 +111,7 @@ func parseLDAPConfig(form auth.AuthenticationForm) *models.LDAPConfig { AttributeSurname: form.AttributeSurname, AttributeMail: form.AttributeMail, AttributesInBind: form.AttributesInBind, + SearchPageSize: pageSize, Filter: form.Filter, AdminFilter: form.AdminFilter, Enabled: true, diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index e3048b218..e4ec3a9f5 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -91,6 +91,16 @@ {{if .Source.IsLDAP}} +
+
+ + +
+
+
+ + +
diff --git a/templates/admin/auth/source/ldap.tmpl b/templates/admin/auth/source/ldap.tmpl index 213195021..cf906f703 100644 --- a/templates/admin/auth/source/ldap.tmpl +++ b/templates/admin/auth/source/ldap.tmpl @@ -62,4 +62,14 @@
+
+
+ + +
+
+
+ + +