Topic
2 replies Latest Post - ‏2014-02-20T16:10:18Z by BoeBrian
Specialist CM
Specialist CM
8 Posts
ACCEPTED ANSWER

Pinned topic Users can checkout the element from main

‏2014-02-19T12:06:43Z |

Hii,

Some of our users have permissions to perform merging and branching activities on main and CM branches.

We just found some users merged the code changes to main branch.

Please let me know how to remove the permissions and also need to check if any other users have access regarding the same.

Generally, only adminx (vob owner) should have access on main branch and CM Branches. Requesting you to provide some

suggessions regarding the same. Thanks!

 

 

  • jeff98air
    jeff98air
    817 Posts
    ACCEPTED ANSWER

    Re: Users can checkout the element from main

    ‏2014-02-19T22:10:03Z  in response to Specialist CM

    I use a trigger to prevent anyone but the VOB owner from checking in, checking out or changing an unreserved checkout to reserved.  Here's my trigger script written in Perl:

    {code}

    #!/usr/bin/perl
    ########################################################################
    #
    # This trigger restricts checkins and reserved checkouts on the
    #   /main branch to the VOB owner.  It also prevents anyone but the
    #   VOB owner from changing an unreserved checkout to reserved.
    #
    # Cleartool command to create the trigger type:
    #   cleartool mktrtype -ele -all -preop checkout,checkin,reserve
    #     -exec "/some/global/path/to/triggers/restrictCoCiOnMain.tgr"
    #     -brtype main
    #     -c "Restrict checkins and reserved checkouts on main branch to the VOB owner"
    #     RESTRICT_CO_CI_ON_MAIN@/vob-name
    #
    ########################################################################

    use strict;

    sub MSWIN { ($^O || $ENV{OS}) =~ /MSWin32|Windows_NT/i ? 1 : 0 }
    my $ctCmd = MSWIN() ? 'cleartool' : '/usr/atria/bin/cleartool';

    # Get necessary VOB and ownership info
    my $status     = 0;      # exit status. Default is 0
    my $ccUsr      = $ENV{CLEARCASE_USER};
       chomp $ccUsr;
    my $currVob    = $ENV{CLEARCASE_VOB_PN};
       chomp $currVob;
    my $ccOpKind   = $ENV{CLEARCASE_OP_KIND};
       chomp $ccOpKind;
    my $ccReserved = $ENV{CLEARCASE_RESERVED};
    my $vobOwner = getVobOwner($currVob);
       chomp $vobOwner;

    if ( $ccUsr ne $vobOwner ) {
        if ( $ccOpKind eq "checkin" || $ccOpKind eq "reserve" || $ccReserved ) {
            $status = 1;
        }
    }

    if ($status) {
        print qq(\nATTENTION: Only the VOB owner "$vobOwner" ) .
       qq(may checkin, reserve, or checkout \(reserved\) ) .
       qq(versions on the \/main branch.\n);
    }

    exit $status;

    sub getVobOwner {
        my($vob) = @_;
        my $vobOwner;
        my $item;
        my @descOutput;
        my @ownerOutput;
       
       @descOutput = qx($ctCmd desc -l vob:${vob} 2>&1);
       chomp @descOutput;
      
       @ownerOutput = grep (/\s+owner\s+/, @descOutput);
       chomp @ownerOutput;

       foreach $item ( split /\s+/, "@ownerOutput" ) {
          chomp $item;
          if ( $item !~ /owner/ && $item !~ /^\s*$/) {
             $vobOwner = $item;
             chomp $vobOwner;
             $vobOwner =~ s/^\w*\.\w*\///m;
          }
       }
       return( defined $vobOwner ? $vobOwner : -1 );
    }

    {code}

  • BoeBrian
    BoeBrian
    22 Posts
    ACCEPTED ANSWER

    Re: Users can checkout the element from main

    ‏2014-02-20T16:10:18Z  in response to Specialist CM

    If only specific users are allowed to make changes to the /main branch, you could lock the branch type and use the -nusers keyword of the lock command.