E-groups in Groups

E-groups for restricting in TWiki Groups now available.

Install

  1. alter _expandUserList in TWikiUserMapping.pm
  2. replace isInList in Users.pm

new _expandUserList function

steps: creating global variable,
pushing $name value to global variable

Code has changed in:
Line 00001
Line 00009

our $names2;                          # new global variable
sub _expandUserList {
    my( $this, $names ) = @_;
    $names ||= '';
    # comma delimited list of users or groups
    # i.e.: "Main.UserA, UserB, Main.UserC # something else"
    $names =~ s/(<[^>]*>)//go;     # Remove HTML tags

    $names2 = $names;     #new global variable
                      
    my @l;
    foreach my $ident ( split( /[\,\s]+/, $names )) {
        # Dump the web specifier if userweb
        $ident =~ s/^($TWiki::cfg{UsersWebName}|Main|Main)\.//;
        next unless $ident;
        if( $this->isGroup( $ident )) {
            my $it = $this->eachGroupMember( $ident );
            while( $it->hasNext() ) {
                push( @l, $it->next() );
            }
        } else {
            # Might be a wiki name (wiki names may map to several cUIDs)
            my %namelist = map { $_ => 1 }
              @{$this->{session}->{users}->findUserByWikiName( $ident )};
            # May be a login name (login names map to a single cUID)
            my $cUID = $this->{session}->{users}->getCanonicalUserID(
                $ident );
            $namelist{$cUID} = 1 if $cUID;
            push( @l, keys %namelist );
        }
    }

    return \@l;
}

Testings

Test environment:
Group: ITDesGroup
Members: IT-DEP

ALLOWTOPICVIEW = ITDesGroup Members from IT-DEP are allowed, Guest is asked to login
ALLOWWEBVIEW = ITDesGroup Members from IT-DEP are allowed, Guest is asked to login
ALLOWTOPICCHANGE = ITDesGroup Members from IT-DEP are allowed, Guest is asked to login
ALLOWWEBCHANGE = ITDesGroup Members from IT-DEP are allowed, Guest is asked to login

DENYTOPICVIEW = ITDesGroup Member from IT-DEP are denied, Guest is asked to login
DENYWEBVIEW = ITDesGroup Member from IT-DEP are denied, Guest is asked to login
DENYTOPICCHANGE = ITDesGroup Members from IT-DEP are denied, Guest is asked to login
DENYWEBCHANGE = ITDesGroup Members from IT-DEP are denied, Guest is asked to login

Test environment:
Group: ITDesGroup
Members: catia-users
User: AlexanderBernegger (not in catia-users)

ALLOWTOPICVIEW = ITDesGroup AlexanderBernegger is not allowed
ALLOWWEBVIEW = ITDesGroup AlexanderBernegger is not allowed
ALLOWTOPICCHANGE = ITDesGroup AlexanderBernegger is allowed to read, not to change
ALLOWWEBCHANGE = ITDesGroup AlexanderBernegger is allowed to read, not to change

DENYTOPICVIEW = ITDesGroup AlexanderBernegger is allowed
DENYWEBVIEW = ITDesGroup AlexanderBernegger is allowed
DENYTOPICCHANGE = ITDesGroup AlexanderBernegger is allowed to read and change
DENYWEBCHANGE = ITDesGroup AlexanderBernegger is allowed to read and change

-- AlexanderBernegger - 15-Mar-2010

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2010-04-21 - unknown
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback