Custom First Page for users

Would it be possible to show a different first page in a Perspective project depending on which user has logged in ?
Maybe using a Session Event ?

There is a feature request to make this possible, but it is not yet. See this discussion:

1 Like

A colleague and I set upon to do this and we managed to get it working. However I have found one instance in my testing which doesn’t allow for it to work which is when you log out and log back in on the same tab. Here is our current setup: We have a database user source where we store not only the username and password but a plethora of columns that pertain to each user. One of those columns is a preferred start up view column which stores an integer (1,2,3) representing a specific view. If you don’t have a user source that allows for modifications to SQL table then you can just create a ‘Settings’ table in which you store all the usernames and a column that specifies the integer. We also have a settings view in our app that allows the users to modify which startup view they want. By default the project has a Welcome view chosen to start. We kept that. We modified that views start up script as follows:

self.session.custom.currentView = "Home"
userIdx = int(self.session.custom.userIdx)
preference = int(system.db.runScalarQuery("SELECT mobileViewPreference FROM listusers WHERE idx = %i"%(userIdx)))

if preference == 0:
	system.perspective.print("No pref, staying here")
	pass
elif preference == 1:
	system.perspective.print("Prefers filters")
	# prefers filters
	system.perspective.navigate("/assetselection")
elif preference == 2:
	system.perspective.print("Prefers checklist")
	system.perspective.navigate("/safetyform")

When the view opens we get the username that is logged in. Run a query to find the integer value that was inserted for their user in the preferred start up view column. There after an if statement checks the value we returned and the value determines the view we are redirected to . Please try this and let me know how it works out. Shout out to @bkarabinchak.psi for working on this with me!

3 Likes

Thanks a lot for your answer,
It is not our priority now but if we try this out I will let you know :wink:

1 Like