[Zope] Generic User Folder and SQL

Daniel Pfile pfiled@marietta.edu
Sun, 28 Nov 1999 21:09:34 -0500 (EST)


Ok, my stupidity is showing again. I think that last error was lack of my
understanding of OOP and dtml-in (doesn't seem like username=username
should work) Ok, now, I'm trying to get some roles returned from GUF so I
can actually limit access. I have two user roles defined STUD
(student) and FULL (full access). There is a dtml method called userRoles
that looks like this:

<dtml-in GetuserRoles>
<dtml-var access>
</dtml-in>

It has proxy access as the Manager. My ZSQL method named GetuserRoles has
username as it's argument and looks like this:

select access from webusers where
usersname = <dtml-sqlvar username type=string>

The column access contains either STUD or FULL, with username being an
exact match of the users's login name.

I have a dtml document to show what kind of access a user has, using the
following dtml:

<dtml-if "AUTHENTICATED_USER.has_role('STUD')">
	You have student access
	<dtml-if "AUTHENTICATED_USER.has_role('FULL')">
		You have full access
	</dtml-if>
<dtml-else>
	You have no access
</dtml-if>

When I log in and hit the page with that dtml in it, sometimes i get the
proper thing back, sometimes I get 'You have no access' showing that it's
not picking up the role info. Sometimes I get an error saying 'username'
is a bad request. And sometimes I can't log in at all. I've tried every
combination of clearing the GUF cache, and restarting netscape that I can
think of. I've tried about 5 different ways of modifying the userRoles
method, including making it an SQL method it's self (i'm running out of
ideas).

Once I figure this stuff out I'm gonna write a HOWTO on using GUF with
SQL. Once again, thankyou for your help.


# Daniel Pfile        # I have no cool signature.
# pfiled@marietta.edu # Finger for free illegal software.