[Zope] Q: LoginManager and SQL-US?

Wilkinson Charlie E Charlie.E.Wilkinson@irs.gov
Wed, 28 Jun 2000 09:37:51 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFE106.102D92CE
Content-Type: text/plain;
	charset="iso-8859-1"

Thanks to Dan Pierson and J.Atwood for pointing me at the GUF/SQL
howto.  I've beating my head against LM since.  I even looked at
the source code (which might be more useful if I spoke Python...

Anyway, here's what I think I've figured out:

Four methods must be created under a UserSource, whether DTML
method, external, or whatever:

	userExists - passed 'username', return 1 if exists.
	userAuthenticate - passed 'username', 'password', return
		1 if valid user.
	userRoles - passed 'username', return user roles in either
		space-delimited string, or list.
	userDomains - passed 'username', return either a list of
		valid domains (example?) or an empty list/string(?)
		to leave it wide open.

How is that?  Am I even getting close?  It's worth noting that I
still haven't been able to get LM working on either of two
installs.

At home I got past userExists and userAuthenticate, but then kept
getting "Forbidden."  It appears that I'm not successfully
returning a list of roles back to the UserSource code.  (When I
uncomment the stuff to report that from ForbiddenPage, my roles
are empty.)  But is it possible that the real problem is the
domains, or something else?

At work, I can't seem to get past the login screen.  I've tried
dropping <dtml-raise ...> and python raise all over the damn
place and it appears that program flow is going nowhere near
those four methods or their wrappers in UserSource.py.  The
traceback shows:

Traceback (innermost last):
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 214,
in publish_module
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 179,
in publish
  File /usr/local/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202, in
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 151,
in publish
  File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/BaseRequest.py, line
446, in traverse
  File
/usr/local/Zope-2.1.6-src/lib/python/Products/LoginManager/LoginManager.py,
line 149, in lm_unauth
    (Object: SheetProviderContainer)
  File /usr/local/Zope-2.1.6-src/lib/python/OFS/DTMLDocument.py, line 166,
in __call__
    (Object: loginForm)
  File /usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: loginForm)
  File /usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Raise.py,
line 128, in render
    (Object: 'LoginRequired')
LoginRequired: (see above)

Clue anyone?

TIA,
	Charlie

> -----Original Message-----
> From: Dan L. Pierson [mailto:dan@sol.control.com]
> 
> Wilkinson Charlie E writes:
>  > 	1. Can LoginManager be (easily?) made to meet my specific need?
> 
> Probably, it includes a GenericUserSource, which is essentially a
> clone of Generic User Folder (see below).
> 
>  > 	2. Has anyone done an SQL UserSource yet, or can anyone
>  > 	   give me a clue how to make one?
> 
> You should look at Generic User Folder, and the HowTo that 
> tell how to 
> set it up with Postgressql.  Basically, you need to create a 
> number of 
> SQLMethods to query your database and some wrappers for these
> methods.  The SQLMethods are the only thing that has to care 
> about the 
> details of your database format.
> 

------_=_NextPart_001_01BFE106.102D92CE
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: [Zope] Q: LoginManager and SQL-US?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Thanks to Dan Pierson and J.Atwood for pointing me at =
the GUF/SQL</FONT>
<BR><FONT SIZE=3D2>howto.&nbsp; I've beating my head against LM =
since.&nbsp; I even looked at</FONT>
<BR><FONT SIZE=3D2>the source code (which might be more useful if I =
spoke Python...</FONT>
</P>

<P><FONT SIZE=3D2>Anyway, here's what I think I've figured out:</FONT>
</P>

<P><FONT SIZE=3D2>Four methods must be created under a UserSource, =
whether DTML</FONT>
<BR><FONT SIZE=3D2>method, external, or whatever:</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>userExists =
- passed 'username', return 1 if exists.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>userAuthenticate - passed 'username', 'password', =
return</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>1 if valid =
user.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>userRoles =
- passed 'username', return user roles in either</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>space-delimited string, or list.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>userDomains - passed 'username', return either a list =
of</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>valid domains =
(example?) or an empty list/string(?)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>to leave it =
wide open.</FONT>
</P>

<P><FONT SIZE=3D2>How is that?&nbsp; Am I even getting close?&nbsp; =
It's worth noting that I</FONT>
<BR><FONT SIZE=3D2>still haven't been able to get LM working on either =
of two</FONT>
<BR><FONT SIZE=3D2>installs.</FONT>
</P>

<P><FONT SIZE=3D2>At home I got past userExists and userAuthenticate, =
but then kept</FONT>
<BR><FONT SIZE=3D2>getting &quot;Forbidden.&quot;&nbsp; It appears that =
I'm not successfully</FONT>
<BR><FONT SIZE=3D2>returning a list of roles back to the UserSource =
code.&nbsp; (When I</FONT>
<BR><FONT SIZE=3D2>uncomment the stuff to report that from =
ForbiddenPage, my roles</FONT>
<BR><FONT SIZE=3D2>are empty.)&nbsp; But is it possible that the real =
problem is the</FONT>
<BR><FONT SIZE=3D2>domains, or something else?</FONT>
</P>

<P><FONT SIZE=3D2>At work, I can't seem to get past the login =
screen.&nbsp; I've tried</FONT>
<BR><FONT SIZE=3D2>dropping &lt;dtml-raise ...&gt; and python raise all =
over the damn</FONT>
<BR><FONT SIZE=3D2>place and it appears that program flow is going =
nowhere near</FONT>
<BR><FONT SIZE=3D2>those four methods or their wrappers in =
UserSource.py.&nbsp; The</FONT>
<BR><FONT SIZE=3D2>traceback shows:</FONT>
</P>

<P><FONT SIZE=3D2>Traceback (innermost last):</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 214, =
in publish_module</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 179, =
in publish</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202, in =
zpublisher_exception_hook</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; (Object: =
ElementWithAttributes)</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 151, =
in publish</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/ZPublisher/BaseRequest.py, line =
446, in traverse</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/Products/LoginManager/LoginManager.=
py, line 149, in lm_unauth</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; (Object: =
SheetProviderContainer)</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/OFS/DTMLDocument.py, line 166, in =
__call__</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; (Object: loginForm)</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py, =
line 502, in __call__</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; (Object: loginForm)</FONT>
<BR><FONT SIZE=3D2>&nbsp; File =
/usr/local/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Raise.py, line =
128, in render</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; (Object: 'LoginRequired')</FONT>
<BR><FONT SIZE=3D2>LoginRequired: (see above)</FONT>
</P>

<P><FONT SIZE=3D2>Clue anyone?</FONT>
</P>

<P><FONT SIZE=3D2>TIA,</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>Charlie</FONT>
</P>

<P><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>&gt; From: Dan L. Pierson [<A =
HREF=3D"mailto:dan@sol.control.com">mailto:dan@sol.control.com</A>]</FON=
T>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Wilkinson Charlie E writes:</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; &nbsp;&nbsp; 1. Can LoginManager be =
(easily?) made to meet my specific need?</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Probably, it includes a GenericUserSource, =
which is essentially a</FONT>
<BR><FONT SIZE=3D2>&gt; clone of Generic User Folder (see =
below).</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; &nbsp;&nbsp; 2. Has anyone done an =
SQL UserSource yet, or can anyone</FONT>
<BR><FONT SIZE=3D2>&gt;&nbsp; &gt; &nbsp;&nbsp; &nbsp;&nbsp; give me a =
clue how to make one?</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; You should look at Generic User Folder, and the =
HowTo that </FONT>
<BR><FONT SIZE=3D2>&gt; tell how to </FONT>
<BR><FONT SIZE=3D2>&gt; set it up with Postgressql.&nbsp; Basically, =
you need to create a </FONT>
<BR><FONT SIZE=3D2>&gt; number of </FONT>
<BR><FONT SIZE=3D2>&gt; SQLMethods to query your database and some =
wrappers for these</FONT>
<BR><FONT SIZE=3D2>&gt; methods.&nbsp; The SQLMethods are the only =
thing that has to care </FONT>
<BR><FONT SIZE=3D2>&gt; about the </FONT>
<BR><FONT SIZE=3D2>&gt; details of your database format.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01BFE106.102D92CE--