[PAS] auth'ed against relational db, but...

4 Messages Forum Options Options
Permalink
Kevin J
[PAS] auth'ed against relational db, but...
Reply Threaded More
Print post
Permalink
Hi,

I've written a plugin that let users to use their login stored in a relational database to sign in the plone site.  The login process passed, but when the I was redirected to the portal, I got the following message:

  File "[...]/eggs/plone.app.layout-1.0.5-py2.4.egg/plone/app/layout/viewlets/common.py", line 178, in update
    fullname = member_info.get('fullname', '')
AttributeError: 'NoneType' object has no attribute 'get'

The following is the code in question:
File: plone/app/layout/viewlets/common.py
[quote]
1        if not self.anonymous:
2          member = portal_state.member()
3          userid = member.getId()
           
4          if sm.checkPermission('Portlets: Manage own portlets', self.context):
5              self.homelink_url = self.portal_url + '/dashboard'
6          else:
7              self.homelink_url = self.portal_url + '/author/' + quote_plus(userid)
           
8          member_info = tools.membership().getMemberInfo(member.getId())
9          fullname = member_info.get('fullname', '')
10        if fullname:
11            self.user_name = fullname
12        else:
13            self.user_name = userid
[/quote]
I traced the code, and found that after line 2, member is assigned with the username that I logged in with (the user in the external database), however, at line 8, member_info is None (because I don't have memberdata for that particular user), so line 9 gives me an error.

How do I remedy this problem? i.e., how do I tell plone to read the member info stored in the external database?  I've tried writing a PropertiesPlugin, but it doesn't work...

Thanks,

Jon Stahl
Re: [PAS] auth'ed against relational db, but...
Reply Threaded More
Print post
Permalink
Kevin J wrote:

> Hi,
>
> I've written a plugin that let users to use their login stored in a
> relational database to sign in the plone site.  The login process passed,
> but when the I was redirected to the portal, I got the following message:
>
>   File
> "[...]/eggs/plone.app.layout-1.0.5-py2.4.egg/plone/app/layout/viewlets/common.py",
> line 178, in update
>     fullname = member_info.get('fullname', '')
> AttributeError: 'NoneType' object has no attribute 'get'
>
> The following is the code in question:
> File: plone/app/layout/viewlets/common.py
> [quote]
> 1        if not self.anonymous:
> 2          member = portal_state.member()
> 3          userid = member.getId()
>            
> 4          if sm.checkPermission('Portlets: Manage own portlets',
> self.context):
> 5              self.homelink_url = self.portal_url + '/dashboard'
> 6          else:
> 7              self.homelink_url = self.portal_url + '/author/' +
> quote_plus(userid)
>            
> 8          member_info = tools.membership().getMemberInfo(member.getId())
> 9          fullname = member_info.get('fullname', '')
> 10        if fullname:
> 11            self.user_name = fullname
> 12        else:
> 13            self.user_name = userid
> [/quote]
> I traced the code, and found that after line 2, member is assigned with the
> username that I logged in with (the user in the external database), however,
> at line 8, member_info is None (because I don't have memberdata for that
> particular user), so line 9 gives me an error.
>
> How do I remedy this problem? i.e., how do I tell plone to read the member
> info stored in the external database?  I've tried writing a
> PropertiesPlugin, but it doesn't work...
>
> Thanks,
>
>
>  
Did you consider using/extending SQLPASPlugin?  
http://plone.org/products/sqlpasplugin

:jon

_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
-----
Jon Stahl
ONE/Northwest
http://www.onenw.org
Aruna Kahiriya
Re: [PAS] auth'ed against relational db, but...
Reply Threaded More
Print post
Permalink
Hi:
You have member in relational database, not on Plone membership, so you will not get member_info from tools.membership. You should write ZSQL to get the user data from external database. (if you are not using any ORM).

Regards,
Aruna Kathiriya
CIGNEX Technologies.



Kevin J wrote:
Hi,

I've written a plugin that let users to use their login stored in a relational database to sign in the plone site.  The login process passed, but when the I was redirected to the portal, I got the following message:

  File "[...]/eggs/plone.app.layout-1.0.5-py2.4.egg/plone/app/layout/viewlets/common.py", line 178, in update
    fullname = member_info.get('fullname', '')
AttributeError: 'NoneType' object has no attribute 'get'

The following is the code in question:
File: plone/app/layout/viewlets/common.py
[quote]
1        if not self.anonymous:
2          member = portal_state.member()
3          userid = member.getId()
           
4          if sm.checkPermission('Portlets: Manage own portlets', self.context):
5              self.homelink_url = self.portal_url + '/dashboard'
6          else:
7              self.homelink_url = self.portal_url + '/author/' + quote_plus(userid)
           
8          member_info = tools.membership().getMemberInfo(member.getId())
9          fullname = member_info.get('fullname', '')
10        if fullname:
11            self.user_name = fullname
12        else:
13            self.user_name = userid
[/quote]
I traced the code, and found that after line 2, member is assigned with the username that I logged in with (the user in the external database), however, at line 8, member_info is None (because I don't have memberdata for that particular user), so line 9 gives me an error.

How do I remedy this problem? i.e., how do I tell plone to read the member info stored in the external database?  I've tried writing a PropertiesPlugin, but it doesn't work...

Thanks,
Kevin J
Re: [PAS] auth'ed against relational db, but...
Reply Threaded More
Print post
Permalink
Could you provide more details on how I provide user data from external database to Plone?  'cause on line 8 of the code I quoted, it gets member data directly from portal_membership...where can I insert my member lookup code for Plone to use my external member data?


Hi:
You have member in relational database, not on Plone membership, so you will not get member_info from tools.membership. You should write ZSQL to get the user data from external database. (if you are not using any ORM).

Regards,
Aruna Kathiriya
CIGNEX Technologies.



Kevin J wrote:
Hi,

I've written a plugin that let users to use their login stored in a relational database to sign in the plone site.  The login process passed, but when the I was redirected to the portal, I got the following message:

  File "[...]/eggs/plone.app.layout-1.0.5-py2.4.egg/plone/app/layout/viewlets/common.py", line 178, in update
    fullname = member_info.get('fullname', '')
AttributeError: 'NoneType' object has no attribute 'get'

The following is the code in question:
File: plone/app/layout/viewlets/common.py
[quote]
1        if not self.anonymous:
2          member = portal_state.member()
3          userid = member.getId()
           
4          if sm.checkPermission('Portlets: Manage own portlets', self.context):
5              self.homelink_url = self.portal_url + '/dashboard'
6          else:
7              self.homelink_url = self.portal_url + '/author/' + quote_plus(userid)
           
8          member_info = tools.membership().getMemberInfo(member.getId())
9          fullname = member_info.get('fullname', '')
10        if fullname:
11            self.user_name = fullname
12        else:
13            self.user_name = userid
[/quote]
I traced the code, and found that after line 2, member is assigned with the username that I logged in with (the user in the external database), however, at line 8, member_info is None (because I don't have memberdata for that particular user), so line 9 gives me an error.

How do I remedy this problem? i.e., how do I tell plone to read the member info stored in the external database?  I've tried writing a PropertiesPlugin, but it doesn't work...

Thanks,