Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:17:21+00:00 2026-06-07T23:17:21+00:00

Development team that uses Subversion’s locking feature and VisualSVN Server with Active Directory authentication

  • 0

Development team that uses Subversion’s locking feature and VisualSVN Server with Active Directory authentication (Integrated Windows Authentication or Basic Authentication) may need to restrict anyone except administrators to steal locks.

Such task can be achieved with a pre-lock hook. However since the authentication relies on Active Directory users and groups, writing such a script can be a bit tricky.

Also there may be other cases when certain AD users’ actions must be processed by a hook script differently based on their AD domain groups membership.

Is there any sample that show how to check AD domain group membership with a Subversion hook?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:17:23+00:00Added an answer on June 7, 2026 at 11:17 pm

    You can check AD group membership with the sample PowerShell pre-lock hook script provided below.

    The pre-lock.ps1 PowerShell script checks whether the user is a member of the Administrators Active Directory group and denies to steal lock if the user is not a member of the group.

    Put both pre-lock.bat and pre-lock.ps1 into your repository ‘hooks’ folder, e.g. C:\Repositories\repository\hooks\.

    pre-lock.ps1

    # Function check if $user is a member of $group
    function Check-GroupMembership
    {
      param([string]$group, [string]$user)
    
      $server = get-content env:COMPUTERNAME
      $query = [ADSI]("WinNT://$server/$group,group")
    
      $ulist = $query.psbase.invoke("Members") |`
               %{$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}
    
      $ulist -contains $user
    }
    
    # Store hook arguments into variables with mnemonic names
    $repos     = $args[0]
    $path      = $args[1]
    $user      = $args[2]
    $comment   = $args[3]
    $steallock = $args[4]
    
    # Build path to svnlook.exe
    $svnlook = "$env:VISUALSVN_SERVER\bin\svnlook.exe"
    
    # Get the lock description
    $lockdescr = (&"$svnlook" lock $repos $path)
    
    # Find owner name
    foreach ($str in $lockdescr)
    {
      if ($str.StartsWith("Owner: "))
      {
        $owner = $str.Substring(7)
    
        # We find lock owner's name and it is not the user name
        if ($owner -ne "" -and $owner -ne $user)
        {
          # If the $user is a member of 'Administrators'
          # group allow to steal the lock
          if (-not (Check-GroupMembership "Administrators" $user))
          {
            [Console]::Error.WriteLine("Error: $path already locked by $owner.")
            exit 1
          }
        }
    
        exit 0
      }
    }
    
    exit 0
    

    pre-lock.bat

    @echo off
    set PWSH=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
    %PWSH% %1\hooks\pre-lock.ps1 %1 %2 %3 %4 %5
    if errorlevel 1 exit %errorlevel%
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the biggest software development team that uses Python? I am wondering how
I work with a team that uses Behaviour Driven Development(BDD) to deliver our applications.
Our dev team uses VS.NET for app development and TortoiseSVN/VisualSVN for version control. It
My team uses an internal team maven repo that is shared from a development
We have an internal software development team in my company that are building a
Our development team uses Eclipse + Aptana to do their web development work. Currently,
Say you have a project that uses maven and a subversion repository. It consists
We are a team of many developers working on a website that uses both
Our team uses SVN to keep track of our day-to-day development. However, when it
I'm part of a development team that works on many CMS based projects, using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.