phpipam icon indicating copy to clipboard operation
phpipam copied to clipboard

Set default widget and Menu Type for all current and future users

Open yurividal opened this issue 5 years ago • 3 comments

Hi. Is there a way (or perhaps there should be one) to set the default widgets that every user will see on the dashboard and also the Menu Type (static) to all the users?

yurividal avatar Feb 11 '20 13:02 yurividal

I second this! Being able to set the default layout for users would be great.

Grunticus03 avatar Mar 23 '23 14:03 Grunticus03

Hi. I just wanted to share that you can achieve this manually in the database. You should be extremely cautious when modifying the database directly, and you should take a full database backup before changing things manually. Making changes directly to your database could also cause unexpected behavior in future releases of phpipam.

You can see a summary of active widgets like this:

MariaDB [phpipam]> select `widgets`,count(*) from `users` group by `widgets`;
+-----------------------------------------------------------------------------+----------+
| widgets                                                                     | count(*) |
+-----------------------------------------------------------------------------+----------+
| favourite_subnets;statistics;changelog;top10_hosts_v4                       |        1 |
| statistics;changelog;error_logs;customers;access_logs;top10_hosts_v4;ipcalc |        1 |
| statistics;favourite_subnets;changelog;top10_hosts_v4                       |       79 |
+-----------------------------------------------------------------------------+----------+

You'll notice that 79 users have the same string of widgets. That's because it's the default string. You can see the default string like this:

MariaDB [phpipam]> show columns from `users` where `Field` in ('menutype','widgets');
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+
| Field    | Type                     | Null | Key | Default                                               | Extra |
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+
| widgets  | varchar(1024)            | YES  |     | statistics;favourite_subnets;changelog;top10_hosts_v4 |       |
| menuType | enum('Static','Dynamic') | NO   |     | Dynamic                                               |       |
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+

You can change the default settings of NEW users like this:

* i did not test these commands, but i expect that they should work correctly
ALTER TABLE `users` CHANGE `widgets` `widgets` varchar(1024) DEFAULT 'instructions;threshold;inactive-hosts;ipcalc';
ALTER TABLE `users` CHANGE `menuType` `menuType` enum('Static','Dynamic') DEFAULT 'Static';

This does not modify users who already exist, but you could overwrite their strings if you wanted to.

I hope this helps.

riversdev0 avatar Aug 19 '24 16:08 riversdev0

Hi. I just wanted to share that you can achieve this manually in the database. You should be extremely cautious when modifying the database directly, and you should take a full database backup before changing things manually. Making changes directly to your database could also cause unexpected behavior in future releases of phpipam.

You can see a summary of active widgets like this:

MariaDB [phpipam]> select `widgets`,count(*) from `users` group by `widgets`;
+-----------------------------------------------------------------------------+----------+
| widgets                                                                     | count(*) |
+-----------------------------------------------------------------------------+----------+
| favourite_subnets;statistics;changelog;top10_hosts_v4                       |        1 |
| statistics;changelog;error_logs;customers;access_logs;top10_hosts_v4;ipcalc |        1 |
| statistics;favourite_subnets;changelog;top10_hosts_v4                       |       79 |
+-----------------------------------------------------------------------------+----------+

You'll notice that 79 users have the same string of widgets. That's because it's the default string. You can see the default string like this:

MariaDB [phpipam]> show columns from `users` where `Field` in ('menutype','widgets');
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+
| Field    | Type                     | Null | Key | Default                                               | Extra |
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+
| widgets  | varchar(1024)            | YES  |     | statistics;favourite_subnets;changelog;top10_hosts_v4 |       |
| menuType | enum('Static','Dynamic') | NO   |     | Dynamic                                               |       |
+----------+--------------------------+------+-----+-------------------------------------------------------+-------+

You can change the default settings of NEW users like this:

* i did not test these commands, but i expect that they should work correctly
ALTER TABLE `users` CHANGE `widgets` `widgets` varchar(1024) DEFAULT 'instructions;threshold;inactive-hosts;ipcalc';
ALTER TABLE `users` CHANGE `menuType` `menuType` enum('Static','Dynamic') DEFAULT 'Static';

This does not modify users who already exist, but you could overwrite their strings if you wanted to.

I hope this helps.

Holy Necro, Batman! I believe that's what I did, it's been a minute. However, it would be nice if this were a feature exposed in the GUI. Being logged in as the local admin, setting up the dashboard the way I want and when I save, having an option to say "Make this the default for all users" or "Make this the default for all new users", would be ideal...but I'd also take a drop-down or something.

Grunticus03 avatar Aug 19 '24 17:08 Grunticus03