Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

Security for objects being called

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


teebes at gmail

Sep 15, 2008, 4:44 PM

Post #1 of 5 (825 views)
Permalink
Security for objects being called

Hello all,

I'm trying to figure out how to prevent certain zope objects from being
called directly but allow them to be called from another object.

Here is an example:
You have a ZPT page, let's originally call it 'test'
test calls a Script(Python) 'script'

I want any anonymous user to be able to call 'test' from the web but not
'script'. However, I want 'test' to call 'script' and render the contents of
'script' to anonymous users through 'test'. I tested this out by making the
'script' View permission only available for Authenticated users, and as
anonymous I can neither hit 'test' nor 'script'.

Based on my understanding of the Zope security framework I don't think
this is possible... hopefully someone can tell me I'm wrong though and show
me how to do it :)

Thanks very much for your time,

- Thibaud


slinkp at gmail

Sep 16, 2008, 4:48 AM

Post #2 of 5 (762 views)
Permalink
Re: Security for objects being called [In reply to]

On Mon, Sep 15, 2008 at 07:44:58PM -0400, Thibaud Morel l'Horset wrote:
> Hello all,
>
> I'm trying to figure out how to prevent certain zope objects from being
> called directly but allow them to be called from another object.
>
> Here is an example:
> You have a ZPT page, let's originally call it 'test'
> test calls a Script(Python) 'script'
>
> I want any anonymous user to be able to call 'test' from the web but not
> 'script'. However, I want 'test' to call 'script' and render the contents of
> 'script' to anonymous users through 'test'. I tested this out by making the
> 'script' View permission only available for Authenticated users, and as
> anonymous I can neither hit 'test' nor 'script'.
>
> Based on my understanding of the Zope security framework I don't think
> this is possible... hopefully someone can tell me I'm wrong though and show
> me how to do it :)

http://plope.com/Books/2_7Edition/Security.stx#2-62


--

Paul Winkler
http://www.slinkp.com
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


teebes at gmail

Sep 16, 2008, 5:55 AM

Post #3 of 5 (765 views)
Permalink
Re: Security for objects being called [In reply to]

Thanks for the response Paul. I don't see a Proxy tab on Page Templates
though, only DTML methods: do I need to install an additional product for
that? or is it configured somewhere else for Templates?

On Tue, Sep 16, 2008 at 7:48 AM, Paul Winkler <slinkp [at] gmail> wrote:

> On Mon, Sep 15, 2008 at 07:44:58PM -0400, Thibaud Morel l'Horset wrote:
> > Hello all,
> >
> > I'm trying to figure out how to prevent certain zope objects from being
> > called directly but allow them to be called from another object.
> >
> > Here is an example:
> > You have a ZPT page, let's originally call it 'test'
> > test calls a Script(Python) 'script'
> >
> > I want any anonymous user to be able to call 'test' from the web but
> not
> > 'script'. However, I want 'test' to call 'script' and render the contents
> of
> > 'script' to anonymous users through 'test'. I tested this out by making
> the
> > 'script' View permission only available for Authenticated users, and as
> > anonymous I can neither hit 'test' nor 'script'.
> >
> > Based on my understanding of the Zope security framework I don't think
> > this is possible... hopefully someone can tell me I'm wrong though and
> show
> > me how to do it :)
>
> http://plope.com/Books/2_7Edition/Security.stx#2-62
>
>
> --
>
> Paul Winkler
> http://www.slinkp.com
> _______________________________________________
> Zope maillist - Zope [at] zope
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>


slinkp at gmail

Sep 17, 2008, 6:18 AM

Post #4 of 5 (753 views)
Permalink
Re: Security for objects being called [In reply to]

On Tue, Sep 16, 2008 at 08:55:33AM -0400, Thibaud Morel l'Horset wrote:
> Thanks for the response Paul. I don't see a Proxy tab on Page Templates
> though, only DTML methods: do I need to install an additional product for
> that? or is it configured somewhere else for Templates?

Oops, right you are. Templates don't have proxy roles.

One obvious workaround: Add a dtml method that consists only of
<dtml-var test>. Make this dtml method anonymously viewable, and give
it a proxy role of Authenticated.

Then make your real template, and the script it calls, both viewable
only by Authenticated.


--

Paul Winkler
http://www.slinkp.com
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


dieter at handshake

Sep 17, 2008, 11:01 AM

Post #5 of 5 (758 views)
Permalink
Re: Security for objects being called [In reply to]

Thibaud Morel l'Horset wrote at 2008-9-15 19:44 -0400:
> I'm trying to figure out how to prevent certain zope objects from being
>called directly but allow them to be called from another object.
>
> Here is an example:
> You have a ZPT page, let's originally call it 'test'
> test calls a Script(Python) 'script'

Your options:

* check in "script" that is was not called directly via the Web.
You can do this by checking against "REQUEST['PUBLISHED']".

* give your "script" a non-"None" "index_html" attribute
Then, this "index_html" is called when accessed from the Web;
otherwise, the "script"s "__call__" is called.

* give your "script" and its "__call__" method an empty docstring.



--
Dieter
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.