Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !2182

Closed
Created Dec 05, 2012 by Administrator@rootOwner
  • Report abuse
Report abuse

Rake task that adds or removes users from projects respecting LDAP groups

  • Overview 2
  • Commits 2
  • Changes 1

Created by: elvanja

Existing bulk permission rake task (lib/tasks/bulk_add_permission.rake) doesn't take LDAP groups into account. The main idea is:

  • create a LDAP group and add LDAP users to it
  • create a Gitlab project group that has the same name as the above LDAP group
  • run (cron) this script to:
    • add users from LDAP group to all projects within Gitlab group
    • remove users from Gitlab group that are no longer in LDAP group
    • for projects outside any Gitlab group, do as before (all users to all such projects)

The pull request version is for Gitlab that has username, and will try to pair LDAP users with Gitlab users either by email (mail is the LDAP equivalent) or by username. For Gitlab versions <=3.1.0, where username property on User is not available, use this version: https://gist.github.com/4214666. This version is actually tested and running in production (I'm running 3.1.0), but the difference is trivial so it should work too.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/elvanja/add_or_remove_users_from_project_teams_using_ldap_groups