Is there a way to write a DSL which limits the access by a user? Since this is Ruby, they could write any arbitrary expression such as MyModel.delete_all My users would not do this on purpose, but perhaps by accident. I have read some about Sandboxes, but don''t see how it would prevent something like this. Thanks in advance, Don Mc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 26, 10:10 am, "Don.Mc" <Don.McCl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is there a way to write a DSL which limits the access by a user? Since > this > is Ruby, they could write any arbitrary expression such as > MyModel.delete_all > > My users would not do this on purpose, but perhaps by accident. > I have read some about Sandboxes, but don''t see how it would > prevent something like this.Sandboxes can be created by setting the Safe Level for your application. Ruby has a variable $SAFE which controls the Safe Level. To create a sandbox, set up your enviroment using the default Safe Level (0) and then raise the Safe Level to 4, the highest level. At Safe Level 4 there can be no subsequent changes to the environment. This may be more than you want and may limit the effectiveness of your DSL. Try it out -- see if will work for you. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dale, Thanks! That is exactly what I needed. Regards, Don McClean On Mar 26, 10:26 am, "Dale Martenson" <dale.marten...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 26, 10:10 am, "Don.Mc" <Don.McCl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Is there a way to write a DSL which limits the access by a user? Since > > this > > is Ruby, they could write any arbitrary expression such as > > MyModel.delete_all > > > My users would not do this on purpose, but perhaps by accident. > > I have read some about Sandboxes, but don''t see how it would > > prevent something like this. > > Sandboxes can be created by setting the Safe Level for your > application. Ruby has a variable $SAFE which controls the Safe Level. > To create a sandbox, set up your enviroment using the default Safe > Level (0) and then raise the Safe Level to 4, the highest level. At > Safe Level 4 there can be no subsequent changes to the environment. > This may be more than you want and may limit the effectiveness of your > DSL. Try it out -- see if will work for you.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---