user / edit .. bug ?!

Author Message

Selmah Maxim

Sunday 25 May 2003 9:24:14 am

Hi ...

Really hard to manage such huge project such ez !

After 2 houre of trying to add rights for users to edit they account, i got no result, and finally i found the error (maybe) ..

All the users owner is user id 14, the admin , coz of this now way to let the users edit they accounts, just if you give them full content edit !

i got this from {$userAccount.contentobject|attribute(show,1)} :

_______________________________________
Attribute Type Value
id string 30
section_id string 2
owner_id string 14 <----------- the owner of ram ram user---------
contentclass_id string 4
name string 'ram ram'
is_published string 0
published string 1053873338
modified string 1053873338
current_version string 1
status NULL
remote_id string ''
current object[ezcontentobjectversion] Object
versions array Array(1)
class_name NULL
content_class object[ezcontentclass] Object
contentobject_attributes array Array(3)
owner object[ezcontentobject] Object
related_contentobject_array array Array(0)
related_contentobject_count string 0
can_read boolean false (role:content read *)
can_create boolean false
can_create_class_list array Array(0)
can_edit boolean false (content /edit/Class( User )/Section(Users)/Owner(Self )
can_remove boolean false
data_map array Array(3)
main_parent_node_id string 12
assigned_nodes array Array(1)
parent_nodes array Array(1)
main_node_id string 24
main_node object[ezcontentobjecttreenode] Object
content_action_list boolean false
name string 'ram ram'

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 !

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