[Zope] Getting the requested object's properties (CMF/LoginManager)

Sreeram Ramachandran gro.mareers@sreeram.org
Sat, 19 May 2001 18:48:28 +0800


--bp/iNruPH9dso1Pn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

System: Zope 2.3.2b2, CMF 1.0, LoginManager 0.8.8b1, Zope/Python Newbie :)

I wish to customize the following code in standard_html_header (from the de=
fault CMF skins):

  <dtml-if "_.hasattr(this(),'isEffective') and not isEffective( ZopeTime()=
 )">
  <dtml-unless "portal_membership.checkPermission('Request review',this())
  or portal_membership.checkPermission('Review portal content',this())">
  <dtml-var "RESPONSE.unauthorized()">
  </dtml-unless>
  </dtml-if>

Instead of an HTTP-AUTH dialog (as it now stands), I would like to put out =
a LoginManager-style "forbiddenPage". The following will not work, because =
the "something follows here" (plus the standard_html_footer) section will s=
till get output:

standard_html_header:
  if ...: // same check as above
    <dtml-var forbiddenPage>
  else:
    ...   // normal stuff

some_page:
  <dtml-var standard_html_header>
  ... something follows here ...
  <dtml-var standard_html_footer>

So, what I need to do is to move the "isEffective" check into the LoginMana=
ger or somewhere else upstream in the authentication process. Hopefully, th=
e same place where LoginManager checks to see if it should call "forbiddenP=
age" based on the user's roles versus object's required roles.

Any suggestions on how to code it?

After looking through the code, I realize my problem is not knowing how to =
access the requested object (i.e., equivalent to the "this()" above) as wel=
l as making sure that the portal_membership.checkPermission doesn't somehow=
 end up recursing infinitely. I figure it can be done somehow using PARENTS=
 inside the validate() function in LoginManager.py, but I need help.

Thanks!
Sreeram.

--=20
----------------------------------
Observation is the essence of art.
----------------------------------

--bp/iNruPH9dso1Pn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (OpenBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE7Bk97GPUg0gA1+0QRAoiiAJ48rd88+Sd0NlU8nsJgwV6HjNbvZgCcDNGX
SLIRQSKBL4oqOBilN8mDlYg=
=PryL
-----END PGP SIGNATURE-----

--bp/iNruPH9dso1Pn--