Setting the default login realm

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
jmmcg
Posts: 11
Joined: Fri Mar 06, 2020 10:55 am

Setting the default login realm

Post by jmmcg »

I recently updated cacti to version 1.2.9, latest available from EPEL on CentOS 7. Normally after updating Cacti I make a modification to auth_login.php so that the realm defaults to Local. This is to simplify the login process for our external users who would not use LDAP.

Today when I made the usual change it did not seem to have any effect.

The change. This at line 732:

Code: Select all

array(
		'1' => array(
				'name' => __('Local'),
				'selected' => false
		),
		'2' => array(
				'name' => __('LDAP'),
				'selected' => true
		)
)
becomes this:

Code: Select all

array(
		'1' => array(
				'name' => __('Local'),
				'selected' => true
		),
		'2' => array(
				'name' => __('LDAP'),
				'selected' => false
		)
)
How would I make this change stick in 1.2.9? Is there a different approach that I should be using?
jmmcg
Posts: 11
Joined: Fri Mar 06, 2020 10:55 am

Re: Setting the default login realm

Post by jmmcg »

I am going to partially answer my own question. It looks as if javascript was added to save the preferred realm of the user. To disable that behavior, I made the following changes starting at line 807 noted below.

This, however, is kind of an ugly hack. Is there a better way to do this?

The below:

Code: Select all

$(function() {
 preferredRealm = storage.get('user_realm');

 // Restore the preferred realm
 if ($('#realm').length) {
		 if (preferredRealm !== undefined) {
				 $('#realm').val(preferredRealm);
				 if ($('#realm').selectmenu('instance') !== undefined) {
						 $('#realm').selectmenu('refresh');
				 }
		 }
 }
Became this:

Code: Select all

$(function() {
 preferredRealm = 1;

 // Restore the preferred realm
 if ($('#realm').length) {
		 if (preferredRealm !== undefined) {
				 $('#realm').val(preferredRealm);
				 if ($('#realm').selectmenu('instance') !== undefined) {
						 $('#realm').selectmenu('refresh');
				 }
		 }
 }

User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Setting the default login realm

Post by Osiris »

Good point. I think it's broken still in GitHub.
Before history, there was a paradise, now dust.
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Setting the default login realm

Post by Osiris »

There is a feature enhancement on GitHub. Can you append this change there?
Before history, there was a paradise, now dust.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Setting the default login realm

Post by TheWitness »

This will be in 1.2.11.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jmmcg
Posts: 11
Joined: Fri Mar 06, 2020 10:55 am

Re: Setting the default login realm

Post by jmmcg »

Thanks for looking at this! :)
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests