# Can security be applied at the project level?

**URL:** <https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018>\
**Category:** Archived Topics\
**Created:** [February 27, 2009, 6:46pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018 "2009-02-27T18:46:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 27, 2009, 6:46pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/1 "2009-02-27T18:46:17Z")

</div>

I am creating a number of projects. Each for a different geographical region. The client does not want users from one region (project) to be able to access/control information from another region (project).

This could easily be done if I could assign a security role to a project but I don’t see anywhere that let’s me do that.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [February 27, 2009, 8:39pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/2 "2009-02-27T20:39:38Z")

</div>

Definitely! Make a few Authentication profiles and use the expert authentication query for them.

Assuming you are using a database driven authentication profile, go into the FactoryPMI gateway configuration page. Go to the authentication profiles. Click the edit icon for the one you want. At the bottom of the page, there is a section labeled ‘Query Configuration (expert)’.

You can set this up any way you want, but if you added a ‘location’ column (with an area called East Stack) to the user table, your query would look like:`SELECT Username FROM USERS WHERE Username = '$username$' AND Password = '$password$' AND location = 'East Stack'`  
This will work for one project that is tied to the East Stack location. You cannot pass in the project name like you can the username and password, so you will need to set up another Auth. profile for each project that needs to use the location column. At least this way they all use the same table in the database.

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [February 27, 2009, 9:15pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/3 "2009-02-27T21:15:30Z")

</div>

Another approach would be to assign users a Security Role that represents their location. This is independent of your choice of authentication type) You would then write a “Startup Script” (in [Global Event Scripts](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/Designer/conceptsenvevents.htm)), that runs [fpmi.security.getRoles](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/technical/jython/modulessecurity.htm) to check their permissions. You might log them off (same script module) if they aren’t allowed to run the project in that location. This scheme allows users to be members of any number of locations.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [February 27, 2009, 10:02pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/4 "2009-02-27T22:02:52Z")

</div>

Sorry Robert, I’m running Hybrid and there is no ‘Query Configuration (expert)’.

Nathan: I will look at doing that. I was hoping I wouldn’t have to code it. 😢

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [February 27, 2009, 11:12pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/5 "2009-02-27T23:12:29Z")

</div>

It isn’t a lot of coding. The script will probably look like:`if "East Stack" in fpmi.security.getRoles():
     pass
else:
     fpmi.security.logout()`

I think you can use`if not "East Stack" in fpmi.security.getRoles():
     fpmi.security.logout()`but I can’t check it at the moment.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 28, 2009, 2:01am UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/6 "2009-02-28T02:01:25Z")

</div>

Assigning a list of roles that are allowed to launch a project is a feature request that we are definately going to implement, but the timeframe is roughly 6mo.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 20, 2009, 4:51pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/7 "2009-03-20T16:51:08Z")

</div>

Found a better way. (for Hybrid at least)

Create an Authentication Profile for each project. Cause, authentication is handled externally you don’t have to worry about keeping passwords in sync. And you would have to assign user to multiple roles anyway for those users that require it. This keeps things nice and simple.

(I know Robert, thats what you tried to tell me at first. Sometimes it takes awhile to sink in)

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [March 21, 2009, 2:02am UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/8 "2009-03-21T02:02:06Z")

</div>

Glad that worked for you. Are you using the [retargeting](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/technical/jython/modulessystem.htm#retarget) feature? It allows users to seamlessly link/jump to different FactoryPMI projects that can be hosted on other computers. The transition is seamless if their username/password matches on the new system, otherwise they are prompted to log on to the new system.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 24, 2009, 6:08pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/9 "2009-03-24T18:08:36Z")

</div>

Yes I am using retargeting. That’s why external authentication will work so well.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [March 4, 2010, 6:30pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/10 "2010-03-04T18:30:29Z")

</div>

In Ignition, projects as a whole can specify a list of roles that are required to even log-in in the first place.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [June 8, 2010, 8:56pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/11 "2010-06-08T20:56:28Z")

</div>

That’s one I missed Carl. As that (FPMI) project hasn’t gone to production yet, I’ll have to try to convince the customer to upgrade to ignition.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 14, 2010, 9:36pm UTC](https://forum.inductiveautomation.com/t/can-security-be-applied-at-the-project-level/1018/12 "2010-06-14T21:36:22Z")

</div>

Not a bad idea 🙂
