Thread: [Phplib-users] auth->mode log/reg doubts
Brought to you by:
nhruby,
richardarcher
From: Giancarlo <gia...@na...> - 2002-09-29 22:52:40
|
At the moment an auth class can have mode = log or reg, and we intend it as a default about which form to show. This value can be overridden by a ?mode= as a GET param But at a deeper exam, I came to a different conclusion, and wondere if some oddieties of phplib's logic, in regard, weren't due to an original consideration of this $auth->mode different than the I think we intend, and can be with good reasons In fact there is no need to specify that a protected page is mode=log, every protected page must be accessible by a login_page. But what if the programmer does nmot want to concede the possibility to 'register' for a certain class of auth, let's say admins. In this case, wasn't auth->mode="reg"n intended to say: for this page is alsopossible to register? So ?I'll listen to the ?mode=reg param? What about the auth->mode==log meaning 'any', you can register to this service too by overriding with by ?mode=reg ?? Or how, anyhow, can you prevent registering to a particular auth class? Gian |
From: Joe S. <jo...@be...> - 2002-09-30 14:52:46
|
On Mon, Sep 30, 2002 at 12:48:21AM +0200, Giancarlo wrote: > At the moment an auth class can have mode = log or reg, and we intend it as > a default about which form to show. > > This value can be overridden by a ?mode= as a GET param > > But at a deeper exam, I came to a different conclusion, and wondere if some > oddieties of phplib's logic, in regard, weren't due to an original > consideration of this $auth->mode different than the I think we intend, and > can be with good reasons > > In fact there is no need to specify that a protected page is mode=log, every > protected page must be accessible by a login_page. > > But what if the programmer does nmot want to concede the possibility to > 'register' for a certain class of auth, let's say admins. > In this case, wasn't auth->mode="reg"n intended to say: > > for this page is alsopossible to register? So ?I'll listen to the ?mode=reg > param? I agree this should have been the way it worked inside the class instead of the way it actually works ( always displays the form related to the mode variable). Reg mode should have only allowed a registration form, while log mode would never show a registration form. > What about the auth->mode==log meaning 'any', you can register to this > service too by overriding with by ?mode=reg ?? > > Or how, anyhow, can you prevent registering to a particular auth class? > You may have seen how I did this. In a configuration file I have: ; allow self registration. ; set to 'reg' for self registration, 'log' otherwise. authmode = "reg" This gets set to $_PSL['authmode'] in the application. In the class extending auth, I have this conditional: var $mode = "log"; ...skip... if ($HTTP_GET_VARS['mode']=='reg') { if( !empty($_PSL['authmode'])) { $this->mode = $_PSL['authmode']; } else { $this->mode='reg'; } } else { $this->mode='log'; } in auth.inc So, if regmode is requested and regmode is allowed a registration form will be shown. Otherwise only the loginform will be shown. Joe > Gian > |
From: Giancarlo <gia...@na...> - 2002-09-30 17:36:55
|
Il 16:50, luned=EC 30 settembre 2002, Joe Stewart ha scritto: > > I agree this should have been the way it worked inside the class instea= d > of the way it actually works ( always displays the form related to the > mode variable). Yes, but then this original aim of auth->mode seems has been abandoned al= ong=20 the way by phplib, and mutated to a default... In fact the doc speaks of = it=20 as an intended default... and, as the auth_doregister method is to be=20 provoded in local.inc. one can always have his extended auth class where=20 auth_dorgister says "sorry you cannot register for this"... I have doubts= =20 about the original intentions, but now auth->mode is accepted as meaning = =20 the default mode... And i I see from your example, you adopted another va= r,=20 authmode, to indicate the mode allowed. Right?=20 Gian |
From: Joe S. <jo...@be...> - 2002-09-30 18:36:37
|
On Mon, Sep 30, 2002 at 07:32:28PM +0200, Giancarlo wrote: > Il 16:50, lunedì 30 settembre 2002, Joe Stewart ha scritto: > > > > I agree this should have been the way it worked inside the class instead > > of the way it actually works ( always displays the form related to the > > mode variable). > > Yes, but then this original aim of auth->mode seems has been abandoned along > the way by phplib, and mutated to a default... In fact the doc speaks of it > as an intended default... and, as the auth_doregister method is to be > provoded in local.inc. one can always have his extended auth class where > auth_dorgister says "sorry you cannot register for this"... I have doubts > about the original intentions, but now auth->mode is accepted as meaning > the default mode... And i I see from your example, you adopted another var, > authmode, to indicate the mode allowed. Right? > Correct - the authmode sets what is allowed. So if request url contains ?mode=reg but authmode is "log", the loginform will be displayed not the registerform. |
From: Joe S. <jo...@be...> - 2002-09-30 18:32:35
|
On Mon, Sep 30, 2002 at 12:48:21AM +0200, Giancarlo wrote: > > Or how, anyhow, can you prevent registering to a particular auth class? > I took a look at the code that Kristian posted and it looks like if auth_doregister is called in "log" mode an error message is generated in his example. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phplib/php-lib/php/local.inc?rev=1.29&content-type=text/vnd.viewcvs-markup Seems to me that it is more elegant to never call auth_doregister in "log" mode. Joe > Gian > > |