Make my plugin showing in the user menu

🛈 SYSTEM INFORMATION
OS type and version Debian buster
Webmin version 1.984
Virtualmin version 6.01
Related packages WikiSuite / Virtualmin Tiki Manager · GitLab

Hello!

I had a virtualmin running for a couple of months. Then I installed a new plugin I am writing. I want that plugin appearing to non-root users, but that was not happening. I installed the plugin, enabled the the users to access the plugin in the ACL area. Not only that, but I also changed the server plan to enable the plugin for the users. But none of that worked.

Then I found some cache files at /var/webmin/modules/virtual-server/links-cache/ … I removed the entire folder. After that, the plugin started appearing to the users.

Is that a bug? How to clean these caches from the virtualmin panel after I change ACL or plans?

Thank you

1 Like

I tried to workaround the problem on the virtual_feature.pl, but it didn’t work

In the virtualmin-tikimanager-lib.pl there is a function like below

# /usr/share/webmin/virtualmin-tikimanager/virtualmin-tikimanager-lib.pl
&foreign_require("virtual-server", "virtual-server-lib.pl");
&foreign_require("acl", "acl-lib.pl");

sub tikimanager_enable_virtualmin_user
{
  my ($d) = @_;
  my $module_name = 'virtualmin-tikimanager';

  my $user = &acl::get_user($d->{'user'});
  my @matches = grep(/^$module_name$/, @{ $user->{'modules'} });
  if ($user and ! @matches) {
      push(@{ $user->{'modules'} }, $module_name);
      &acl::modify_user($user->{'name'}, $user);
  }
  return $user;
}

Then, in the virtual_feature.pl I tried

sub feature_setup
{
  my ($d) = @_;
  &$virtual_server::first_print("Activating $module_name for $d->{'user'} ..");
  my $user = tikimanager_enable_virtualmin_user($d);
  if ($user) {
    return 1;
  }
  return 0;
}

sub feature_enable
{
  my ($d) = @_;
  &$virtual_server::first_print($text{'feat_enable'});
  my $user = tikimanager_enable_virtualmin_user($d);
  &$virtual_server::second_print(".. done");
}

Then, checking the /etc/webmin/webmin.acl, I don’t find virtualmin-tikimanager module for the users created with the top-level virtualserver.

Is there anyway to allow access to virtualmin-tikimanager for all new users, by default?

Thank you

1 Like

I added more details and screenshots here

Does your virtual_feature.pl file have a feature_webmin function? This is needed to grant domain owners access, like so : https://github.com/virtualmin/virtualmin-awstats/blob/master/virtual_feature.pl#L595

Note that if you add this during development, you may need to do a one-time re-generation of available modules for a domain’s user by running :

virtualmin modify-domain --domain whatever.com

2 Likes

It works! Thank you!! <3

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.