Adding Users

I would like to add a user for an alternate logon. Then password protect a component to enable for that user. Can you help me?

Typically, new usernames and roles are defined through the gateway. Once you’ve defined them, you would add code to your application to test for the appropriate username and/or role.

For example, assume you have a button that opens a window that you want only accessible to users to whom the role of “Supervisor” has been assigned. In this case, you would use the following code (which I copied directly from the FPMI manual) for the button’s actionPerformed event:

if "Supervisor" in fpmi.security.getRoles(): fpmi.nav.openWindow("ManagementOnly") else: fpmi.gui.errorBox("You don't have sufficient priviledges to continue")
Alternately, you can get the current username with fpmi.security.getUsername().

If you tell us specifically what you want to accomplish and which component you’re using, we can give you a more specific answer.

Thanks for the info. I found where in the help manual you were talking about and after reading and several tries I figured it out.

You should only need scripting with security if you’re doing something fancy. The easier way to apply security is by selecting a component, then selecting “component security (Cntl+E)” from the right click or Component menu. The manual describes it here.

The window allows you to explicitly allow/disallow groups access to the component. Another option selects if you want to hide or disable the component when “secure”.

You can propagate settings by applying to “higher level” containers, breaking inheritance, as necessary.

Thank you for the follow up Nathan. My problem was adding users. I tried to add users using the Gateway but when I logged off and back on with that user I wasn’t able to sign in. I had created a “supervisor” role and assigned that role to the new user but it wasn’t working. As I read further I found that to use FactoryPMI you need to have an Admin role assigned. Once I did that then the user worked. I was trying to assign a component to only be available to the one user. Now that works fine. The scripting came straight from the manual as MickeyBob had suggested. From what he had told me and reading in the manual where he referenced I was able to get everything working as I had planned. You are right, about the scripting not being necessary but I left the scripting as is for now. Even with scripting I found that I needed to use the security feature for the component. Maybe my scripting isn’t 100% but the function that I wanted is working right now.

Good to hear that you got it working!

For reference, you can also configure users and groups to be stored in your SQL database. This allows you to create FactoryPMI windows to manage users (see this free goodie). Alternatively, you can integrate authentication with your Windows Active Directory Domain (LDAP query) or equivalent. This is more technical to implement, but allows enables seamless integration with IT when appropriate.