user / edit .. bug ?!

user / edit .. bug ?!

Sunday 25 May 2003 9:24:14 am - 4 replies

Author Message

Stuart Fenton

Tuesday 27 May 2003 3:21:30 am

I want to be able to allow users to edit their own User account and be able to test if they are logged in or if they are the Anonymous user until they do so.

I don't want them to be able to read other users accounts so I have modified the Anonymous account to only be able to read user accounts if created by themselves. [ Read Class( User ) , Owner( Self ) ]

I then modified the register.php to make the user own the account when they create it rather than use the 'ini' files preference.

This works but then causes a new problem. The fetch('user','current_user') command will no longer tell me if the user is logged in or not as the role prevents the variables being accessed.

Do I need to create a new function definition in the user class (similar to login) that allows me to specifically allow function access within the role for Anonymous user so that I can read the username and user id.

Or are you addressing this in the 3.1 release?

I have one other issue with modifying the register.php code. It seems to have created an issue with the 'can_read' variable not being set.

Is there a better way to resolve this problem?

The code change for register.php is as follows:

After this section:

<literal>
// Create object by user 14 in section 1
$contentObject =& $class->instantiate( $userCreatorID, $defaultSectionID );
$objectID = $contentObject->attribute( 'id' );

//START: A bit of code to renumber the owner_id to the object id
// Modified to ensure that users created through registration own their own account.
// This means that they can then edit their account correctly and not be locked out.
$contentObject->setAttribute( 'owner_id', $contentObject->attribute( 'id' ) );
$contentObject->store();
eZDebug::writeWarning( "Content Owner ID changed to:", $contentObject->attribute( 'owner_id' ) );
// END:
</literal>

Code continues...

Is this the right approach or is there a better way?

Thanks.
Fats.

-- Stuart

stuart@grandmore.com
http://www.grandmore.com

Selmah Maxim

Tuesday 27 May 2003 4:08:11 am

Hi ..

I wouldn`t do it with this way, just keep the owner, and to let the user edit his account , must 1st check if he is loged in, 2nd match the username,password,id (from the session vars) with the requested userid, if is ok he will have the access .

i`ll wait the 3.1 .. maybe few days ,, and maybe this will be fixed, else i`ll modify the register.php !

i had modify alot of files, but now i had started with new copy, and make some new modules and keep the orginal, becoz later i`ll have problems with update !

I think now the Ez team is busy with 3.1, coz of this we got no answer until now .. i hope :)

Selmah Maxim

Tuesday 27 May 2003 4:21:59 am

about this modification will be in user/edit.php , not regiter.php !

Selmah Maxim

Tuesday 27 May 2003 4:35:52 am

i tho i got the fix .. but not yet !
sorry !

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.