Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions list_users.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ if ($mleft != 0) {
}
}
}
# Include user creation links from feature plugins
foreach my $f (&list_feature_plugins()) {
if ($d->{$f} && &plugin_defined($f, "users_create_links")) {
my @plinks = &plugin_call($f, "users_create_links", $d);
push(@links, @plinks) if @plinks;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's technically no need for if @plinks here

}
}
push(@links, [ "mass_ucreate_form.cgi?dom=$in{'dom'}",
$text{'users_batch2'}, "right" ]);

Expand Down
23 changes: 20 additions & 3 deletions virtual-server-lib-funcs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,16 @@ sub list_domain_users
push(@users, &list_extra_web_users($d));
}

# Include users from feature plugins that define list_plugin_users
if ($includeextra) {
foreach my $f (&list_feature_plugins()) {
if ($d->{$f} && &plugin_defined($f, "list_plugin_users")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it comes from a plugin, shouldn’t the function name be feature_list_users for consistency?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to that

my @pu = &plugin_call($f, "list_plugin_users", $d);
push(@users, @pu) if @pu;
}
}
}

# Add any secondary groups in the template
local @sgroups = &allowed_secondary_groups($d);
if (@sgroups) {
Expand Down Expand Up @@ -5723,11 +5733,18 @@ sub users_table
$u->{'webowner'} && $u->{'pass'} =~ /^(\!|\*)/ ? $pop3_dis :
$u->{'webowner'} ? $pop3 :
$u->{'pass'} =~ /^(\!|\*)/ ? $pop3_dis : $pop3);
my $col_val = "<a href='edit_user.cgi?dom=$did$filetype&amp;".
"user=".&urlize($u->{'user'})."'>$col_text</a>";
if (!$virtualmin_pro && $u->{'extra'}) {
my $col_val;
if ($u->{'edit_url'}) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better way to make the PR with fewer changes is to leave the existing code as is and just add your new check if ($u->{'edit_url'}) {...} after the existing logic.

$col_val = "<a href='".&html_escape($u->{'edit_url'}).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that links need to be HTML-escaped? 🙂

"'>$col_text</a>";
}
elsif (!$virtualmin_pro && $u->{'extra'}) {
$col_val = $col_text;
}
else {
$col_val = "<a href='edit_user.cgi?dom=$did$filetype&amp;".
"user=".&urlize($u->{'user'})."'>$col_text</a>";
}
push(@cols, "$col_val\n");
push(@cols, &html_escape($u->{'user'}));
push(@cols, &html_escape($u->{'real'}));
Expand Down