💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# LDAP Rake tasks > 原文:[https://docs.gitlab.com/ee/administration/raketasks/ldap.html](https://docs.gitlab.com/ee/administration/raketasks/ldap.html) * [Check](#check) * [Run a group sync](#run-a-group-sync-starter-only) * [Rename a provider](#rename-a-provider) * [Example](#example) * [Other options](#other-options) # LDAP Rake tasks[](#ldap-rake-tasks-core-only "Permalink") 以下是与 LDAP 相关的 Rake 任务. ## Check[](#check "Permalink") LDAP 检查 Rake 任务将测试`bind_dn`和`password`凭据(如果已配置),并将列出 LDAP 用户的样本. 此任务也作为`gitlab:check`任务的一部分执行,但可以使用以下命令独立运行. **全部安装** ``` sudo gitlab-rake gitlab:ldap:check ``` **源安装** ``` sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production ``` 默认情况下,该任务将返回 100 个 LDAP 用户的样本. 通过将数字传递给检查任务来更改此限制: ``` rake gitlab:ldap:check[50] ``` ## Run a group sync[](#run-a-group-sync-starter-only "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/14735) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.2. The following task will run a [group sync](../auth/ldap/index.html#group-sync-starter-only) immediately. This is valuable when you’d like to update all configured group memberships against LDAP without waiting for the next scheduled group sync to be run. **注意:**如果您想更改执行群组同步的频率,请改为[调整 Cron 时间表](../auth/ldap/index.html#adjusting-ldap-group-sync-schedule-starter-only) . **全部安装** ``` sudo gitlab-rake gitlab:ldap:group_sync ``` **源安装** ``` bundle exec rake gitlab:ldap:group_sync ``` ## Rename a provider[](#rename-a-provider "Permalink") 如果您在`gitlab.yml`或`gitlab.rb`更改 LDAP 服务器 ID,则将需要更新所有用户身份,否则用户将无法登录.输入新旧提供者,此任务将更新数据库中所有匹配的身份. `old_provider`和`new_provider`是从前缀`ldap`加上配置文件中的 LDAP 服务器 ID 派生的. 例如,在`gitlab.yml`或`gitlab.rb`您可能会看到 LDAP 配置,如下所示: ``` main: label: 'LDAP' host: '_your_ldap_server' port: 389 uid: 'sAMAccountName' ... ``` `main`是 LDAP 服务器 ID. 唯一的提供者在一起就是`ldapmain` . > **警告** :如果输入了错误的新提供程序,用户将无法登录.如果发生这种情况,请使用错误的提供程序作为`old_provider`并使用正确的提供程序作为`new_provider`再次运行任务. **全部安装** ``` sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] ``` **源安装** ``` bundle exec rake gitlab:ldap:rename_provider[old_provider,new_provider] RAILS_ENV=production ``` ### Example[](#example "Permalink") 考虑从默认服务器 ID `main` (完整提供程序`ldapmain` )开始. 如果将`main`更改为`mycompany` ,则`new_provider`为`ldapmycompany` . 要重命名所有用户身份,请运行以下命令: ``` sudo gitlab-rake gitlab:ldap:rename_provider[ldapmain,ldapmycompany] ``` 输出示例: ``` 100 users with provider 'ldapmain' will be updated to 'ldapmycompany'. If the new provider is incorrect, users will be unable to sign in. Do you want to continue (yes/no)? yes User identities were successfully updated ``` ### Other options[](#other-options "Permalink") 如果您未指定`old_provider`和`new_provider` ,则会提示您输入它们: **全部安装** ``` sudo gitlab-rake gitlab:ldap:rename_provider ``` **源安装** ``` bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production ``` **输出示例:** ``` What is the old provider? Ex. 'ldapmain': ldapmain What is the new provider? Ex. 'ldapcustom': ldapmycompany ``` 此任务还接受`force`环境变量,该变量将跳过确认对话框: ``` sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] force=yes ```