Bug in Glorp Login >> #= ?

1 view
Skip to first unread message

Mariano Martinez Peck

unread,
Jul 9, 2013, 2:51:29 PM7/9/13
to glorp...@googlegroups.com, dbx...@googlegroups.com, Pharo Development List
Wow...after a couple of hours chasing a problem in my app, I faced a problem with Glorp's Login. I was using a ConnectionPool that uses a Dictionary to store Login. Each kay is a login instance and the value is an instance of a connection pool. 

But I was getting multiple instances (entries in the dictionary and pool instances). The problem is Login >>#= 

= aLogin 
self halt.
^self class == aLogin class and: 
[self name = aLogin name and: 
[self database class = aLogin database class and: 
[self username = aLogin username and: 
[self password = aLogin password 
and: [self connectString = aLogin connectString]]]]]

Because it expects the passwords to be equal, while Login can be "secure" and hence, the password is nil after the login. So what happened here is that my Login were secure (by default you have that behavior) and hence, two Login that were created exactly with the same data will give you false once on of them is logged. 

Solutions?

1) Ignore the password check when using secure connections?

Workarounds?

a) In my app I can try to store somewhere the Login instance and always reuse it. 
But I am not sure if this could work...because I will have multiple PharoDatabaseAccessors pointing to the same Login instance...

b) send a secure: false  to my Login instances.... 

Of course I would try to avoid having to do b).

Any ideas?



--
Mariano
http://marianopeck.wordpress.com
Reply all
Reply to author
Forward
0 new messages