Scripting Get User Password

I am able to get user info through scripting using the following script:

defaultUser = system.user.getUser("","default")
defaultUsername = defaultUser.get("username")

However, this returns nothing:

defaultUser = system.user.getUser("","default")
defaultPassword = defaultUser.get("password")

Are we not allowed to access user passwords through scripting?

I’m wanting to do this so that I can auto-sign in the default user after other users sign out, and have it still work after the default user password changes

No. For security reasons, user passwords are not typically stored in a manner that would allow their retrieval.

Ok, then I guess my solution would be to make it so the default account’s password can’t be changed (from within the client anyway).

I’m trying to use the filterRole() extension function, but it doesn’t seem to be working quite as I expected.

if !userLogged:
		return 0

	elif role == "Guest":
		return 0
	else:
		return 1

Results in this table:


Why is the “default” user not hidden?

It looks like your logic isn't correct.

if role in ('Guest','default') or not userLogged:
	return 0
else:
	return 1

That did not fix the issue, and I really didn’t expect it to. Why would the filterRoles() extension function look at the username?

Oops, I looked at default as a role instead of username. It should have still worked since there isn’t a default role to worry about. The filterRole() extension function customizes the list of roles not the list of users. filterRole() is applied to user management component’s role table if it has Role Management Enabled property selected. You should add a script to the filterUser() extension function

if 'Guest' in user.getRoles():
	return 0
else: 
	return 1

Thanks for the help.
This is what ended up working in the filterUser() extension function:

if user.get("username") == "default" or !userLoggedIn:
		return 0
	else:
		return 1

this works as well:

if "Guest" in user.getRoles() or !userLoggedIn:
		return 0
	else:
		return 1

That works too, but if you add another user with the Guest role it won’t filter it out. It’s fine if default is the only one that will have the Guest role. If userLoggedIn is a boolean, then the correct syntax is to use not.

Practically, there will be little to no difference between ! and not in this case

If I’m not mistaken ! isn’t a python operator. The bitwise not operator is ~.

You are correct, by it still seemed to work ¯_(ツ)_/¯