Forums / Developer / user / edit .. bug ?!

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 !

eZ debug

Timing: Jan 18 2025 05:11:36
Script start
Timing: Jan 18 2025 05:11:36
Module start 'content'
Timing: Jan 18 2025 05:11:36
Module end 'content'
Timing: Jan 18 2025 05:11:36
Script end

Main resources:

Total runtime0.1495 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.5391180.8516
Module start 'content' 0.00630.0052 768.390697.8281
Module end 'content' 0.01150.1379 866.2188533.2344
Script end 0.1494  1,399.4531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.2104200.0002
Check MTime0.00130.8412200.0001
Mysql Total
Database connection0.00080.543810.0008
Mysqli_queries0.107571.87481410.0008
Looping result0.00151.01931390.0000
Template Total0.137692.110.1376
Template load0.00070.462810.0007
Template processing0.136991.584410.1369
Override
Cache load0.00050.323110.0005
Sytem overhead
Fetch class attribute can translate value0.00110.714410.0011
XML
Image XML parsing0.00030.185910.0003
General
dbfile0.00140.9630200.0001
String conversion0.00000.003530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs