Displaying the logged on username

I figured I would post this in case anybody else out there needed to do this.

I selected the window I wanted this to be on and click the little gear icon to bring up the action configuration screen for this window.

I selected the internalFrameActivated event and inserted the following script:

username = fpmi.security.getUsername() root = event.source.rootContainer label = root.getComponent('User Label') label.text = "User: " + username

Thanks go to Carl for helping me with this.

Carl, you mentioned that I could also manipulate the way the user name is diplayed. For logon purposes I am constrained to using the convention used by the company. I think it would be slick to actually display the user’s full name.

for instance the logon name convention for Firstname Lastname would be:flastname. I would like it to display Firstname Lastname.

Also I have seen reference to allowing user management from within Factory PMI. So I could set up someone with a role of say “supervisor” to allow them to add user names and passwords as people come and go. I would however like to restrict their ability to make any changes to people in the admin roles. As in they can’t touch that or even see it. Is this possible?

FYI, this isn’t a high priority so don’t stop the presses for it.

First of all, what kind of authentication profile are you using? Only DB-based authentication profiles can be managed from with in a FactoryPMI project. To do this, you’d use the user managament goodie from the goodies page - and you can customize it to your hearts content in terms of restricting certain kinds of edits.

As far as displaying the full name rather than the login name, this is easy but of course you need to have this data somewhere! You could add first name and last name columns to the database table that the db-based authentication profile creates, and store the data in there - I think this would be the most natural.

Then in your internalFrameActivated script you’d simply run a query to select the first name and last name of the user based on their login name.

Hope this helps,

To clear things up, he’s using the default (internal) authentication profile. I mentioned that it’d be possible to display the full user name. We didn’t get into implementation details.

I agree that going to an SQL database based database profile might make the most sense. This is because you will need to enter a First and Last name to go with each login name, so you might as well allow full user administration. The User management goodie can be downloaded here if you’re interested. Keep posting your questions to the forum on customizing it to your exact needs.

Thank you. I did a quick look over on doing that way. It is a backburner issue for now.