RE: [Zope] Q: LoginManager and SQL-US?

2000-06-28 Thread Wilkinson Charlie E
Title: RE: [Zope] Q: LoginManager and SQL-US?





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  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:[EMAIL PROTECTED]]
> 
> 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.
> 





Re: [Zope] Q: LoginManager and SQL-US?

2000-06-13 Thread J. Atwood

I think this is what you want...

http://www.zope.org/Members/hippy/GUF_SQL_crypt_1_2

How To: Use GenericUserFolder with an SQL database Version 1.1

J


From: Wilkinson Charlie E <[EMAIL PROTECTED]>
Date: Tue, 13 Jun 2000 11:29:48 -0400
To: [EMAIL PROTECTED]
Subject: [Zope] Q: LoginManager and SQL-US?



Ok, I've got this legacy database app (VisualBasic and Access - Bleck!)
that I'm moving to Apache/Zope/PostgreSQL.  One of the existing database
tables is user info, i.e. userid, password, real name, an "account
disabled" boolean, etc.

I've figured out a really stupid way to "solve" the problem, essentially
doing queries against the user table and having conditionals in every
DTML object to determine if the user should be there or not.  (Actually,
I negated some of that silliness by incorporating SQLSession into the
mix.)  Still, I'm faced with needing some way to check the user/session
against each requested object.  And no, there's not much access
granularity here - the user should either have access to the whole
folder, or not. 

LoginManager looks promising, but I'm still enough of a Zope newbie that
I've hit a bit of a roadblock, boiling down (boiled roadblock?!?) to 2
fundemental questions:

1. Can LoginManager be (easily?) made to meet my specific need?
2. Has anyone done an SQL UserSource yet, or can anyone
   give me a clue how to make one?

I've tried "creating" another US, but after that Zope just sits there,
quietly mocking me.  I did read the API stuff and that actually makes
a little sense to me, but I don't know what types of objects (or
external methods?) would need to be created as part of a new US
interface.  In other words, I more or less understand the API calls, I
can do SQL queries in my sleep, but how does one tie it all together
into a new US?  Does it involve (*shudder*) writing Python? ;)

I'd be happy to share back any useful results of this exercise.

Thanks for any help,
Charlie 

-- 
Charlie Wilkinson - TRIS Development Systems Administrator
IS:SD:CT:CC:TD 
Phone: 202-283-3241
MSMail:   Charlie E Wilkinson 
SMTP:  [EMAIL PROTECTED] 
Home:  [EMAIL PROTECTED]
This message constructed from 90% post-consumer electrons.



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )