# Restrict Scripts

**URL:** <https://forum.inductiveautomation.com/t/restrict-scripts/4835>\
**Category:** Ignition\
**Created:** [July 18, 2012, 7:32am UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835 "2012-07-18T07:32:05Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [July 18, 2012, 7:32am UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/1 "2012-07-18T07:32:05Z")

</div>

Hello,

It is possible to resctrict scripting in a project?

---

<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:** [July 18, 2012, 8:18am UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/2 "2012-07-18T08:18:01Z")

</div>

What exactly are you trying to accomplish?

---

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [July 18, 2012, 2:49pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/3 "2012-07-18T14:49:51Z")

</div>

I’m trying to hide my scripts from other users

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 18, 2012, 3:16pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/4 "2012-07-18T15:16:33Z")

</div>

Well, in this case there are two things you can do:

1. Make your own functions using the module SDK such as an expression or scripting function to hide the code.

2. You can lock the project so they can’t edit it in the designer.

---

<div class="post-metadata">

**Author:** ![tailfire](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tailfire](https://forum.inductiveautomation.com/u/tailfire)\
**Post date:** [July 19, 2012, 3:33am UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/5 "2012-07-19T03:33:20Z")

</div>

how do you carry out the number 2 option?

---

<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:** [July 19, 2012, 5:20am UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/6 "2012-07-19T05:20:36Z")

</div>

Is there a python function to execute code contained in a variable? If so, you could store your code in your SQL database, then use the security in the RDBMS system.

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [July 19, 2012, 1:52pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/7 "2012-07-19T13:52:43Z")

</div>

```auto
eval("print (7+9)")
```

Storing code in the SQL database sounds like disaster waiting to happen…

---

<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:** [July 19, 2012, 2:11pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/8 "2012-07-19T14:11:06Z")

</div>

> [@Greg.Buehler](#):
>
> Storing code in the SQL database sounds like disaster waiting to happen...

Sounds like stored procedures to me 🙂

---

<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:** [July 19, 2012, 2:55pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/9 "2012-07-19T14:55:40Z")

</div>

I'm not sure one way or another. You are adding a layer to troubleshooting and possibly providing a vector for things like SQL injection attacks.

I haven't tried or really thought about that. Treat is as "another wild idea" 🙂.

> [@Greg.Buehler](#):
>
> Storing code in the SQL database sounds like disaster waiting to happen...

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 19, 2012, 3:08pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/10 "2012-07-19T15:08:21Z")

</div>

I don’t think code run through eval() would have access to the surrounding context, i.e., events, components, etc… Aside from it being just not a good idea. There’s also performance implications.

---

<div class="post-metadata">

**Author:** ![tailfire](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tailfire](https://forum.inductiveautomation.com/u/tailfire)\
**Post date:** [July 19, 2012, 4:36pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/11 "2012-07-19T16:36:47Z")

</div>

How about an answer for #2 from Travis? Would this just be implementing the security policy role to  
allow or not allow access to the designer/project.  
How does this work down to the project level when two separate users have access to designer?

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 19, 2012, 6:45pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/12 "2012-07-19T18:45:07Z")

</div>

I would suggest making a role that only the person(s) who is designing the project has a username and password for. Restrict your access by only assigning certain people access.

---

<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:** [July 19, 2012, 8:26pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/13 "2012-07-19T20:26:10Z")

</div>

I think this gets into the more general issues of: more flexible role based security and natively supporting multiple authors and projects.

The first idea extends control over roles, functions, and objects (ie, a group/person that can edit some scripts/windows/tags/users, but not others). The idea has been kicked around for a more flexible security model. There are a number of builtin or architectural means that could support such requirements. I tend to first favor simplicity, then programmatic flexibility.

In the past we’ve kicked around the idea of a “hosted” version where an Integrator could have a number of customers who each have admin level access to their own project, but not each other’s. This could be seamless, like how the large web hosting sites do it for concurrent customers. I would expect this to naturally cover different levels of admins for a single project.

Again, my $.02 looking into future features.

---

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [September 12, 2012, 2:13pm UTC](https://forum.inductiveautomation.com/t/restrict-scripts/4835/14 "2012-09-12T14:13:23Z")

</div>

Thanks for all your answers. I will try using JDK ![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:")
