Feature Proposal: An "All Users" Group
Motivation
Having such a group would help in access control, particularly in areas such as a web where access in controlled, but comments can be added to an included topic with access allowed.
Description and Documentation
A group which includes all registered users.
Examples
Impact and Available Solutions
Implementation
Here's a first cut I tried this morning:
I've added:
push(@{$this->{grouplist}}, $this->findUser($TWiki::cfg{AllRegisteredUsersGroup}));
into
getAllGroups() -- (Users.pm)
like so :
sub getAllGroups() {
my $this = shift;
ASSERT($this->isa( 'TWiki::Users')) if DEBUG;
unless (defined($this->{grouplist})) {
# Always add $cfg{SuperAdminGroup}
my $sawAdmin = 0;
@{$this->{grouplist}} =
map { $sawAdmin ||= ($_->wikiName() eq $TWiki::cfg{SuperAdminGroup}); $_ }
$this->{usermappingmanager}->getListOfGroups();
if (!$sawAdmin) {
push(@{$this->{grouplist}}, $this->findUser($TWiki::cfg{SuperAdminGroup}));
}
+ push(@{$this->{grouplist}}, $this->findUser($TWiki::cfg{AllRegisteredUsersGroup}));
}
return \@{$this->{grouplist}};
}
also I've added:
} else {
if ($group->{wikiname} eq "AllRegisteredUsersGroup") {
$group->{members} = $this->{session}->{users}->getAllUsers;
}
}
into
groupMembers() -- (TWikiUserMapping.pm)
like so:
sub groupMembers {
my $this = shift;
my $group = shift;
ASSERT($this->isa( 'TWiki::Users::TWikiUserMapping')) if DEBUG;
my $store = $this->{session}->{store};
if( !defined $group->{members} &&
$store->topicExists( $group->{web}, $group->{wikiname} )) {
my $text =
$store->readTopicRaw( undef,
$group->{web}, $group->{wikiname},
undef );
foreach( split( /\r?\n/, $text ) ) {
if( /$TWiki::regex{setRegex}GROUP\s*=\s*(.+)$/ ) {
next unless( $1 eq 'Set' );
# Note: if there are multiple GROUP assignments in the
# topic, only the last will be taken.
$group->{members} =
$this->{session}->{users}->expandUserList( $2 );
}
}
# backlink the user to the group
foreach my $user ( @{$group->{members}} ) {
push( @{$user->{groups}}, $group );
}
+# }
+ } else {
+ if ($group->{wikiname} eq "AllRegisteredUsersGroup") {
+ $group->{members} = $this->{session}->{users}->getAllUsers();
+ }
+ }
return $group->{members};
}
All of this
seems to work but the modification seemed too simple, and I don't really know enough about TWiki to be sure.
--
Contributors: GregPendlebury
Discussion
--
GregPendlebury - 14 Nov 2006
This started in
Support.GroupWithAllUsers. An AllUsersGroup or AllRegisteredUsersGroup would be useful to have. It could be done implicitly with a TWiki internal test, e.g. without the need to update the AllUsersGroup at registration time.
--
PeterThoeny - 14 Nov 2006
Updated with my first try at a working version.
--
GregPendlebury - 11 Dec 2006