Change user policies / group via an automated script + mySQL

Author Message

Magnus Olsson

Tuesday 03 January 2006 5:36:48 am

Hi,
I have a slight problem concerning how to manipulate a users usergroup via a SQL-query.

The application I'm coding is supposed to let a user insert a one time code (provided to her via SMS) into a table, and when the code is accepted by the system, it should place the user in usergroup Z

I've been searching through the database for some sort of cross-reference table that tells eZ that user X is part of usergroup Y but to no avail.

The ugly solution would be to make a separate table in the database, telling if user X has inserted the code and having the webpage query that table every time the user tries to access a restricted part of the site. But a solution just placing the user in the correct usergroup would be a lot prettier.

Any suggestions or pointers in the right direction is highly appreciated!

Xavier Dutoit

Tuesday 03 January 2006 9:24:04 am

Why don't you use the php classes provided by ez ? Much easier and robust than dig into the sql!

Setting the user right is based on its location of the user node. Have a look at the various code around (eg the one for the content move), but if you change the location of the user to a new usergroup, that should do it.

Let us know...

X+

http://www.sydesy.com

Magnus Olsson

Tuesday 03 January 2006 10:36:37 pm

Because I'm so new at this system (actually just helping a friend with my limited knowledge of PHP / MySQL) I didn't even know about class you mentioned.

Thanks for the tip, I'll go check the classes ASAP :)

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

eZ debug

Timing: Jan 31 2025 04:19:31
Script start
Timing: Jan 31 2025 04:19:31
Module start 'layout'
Timing: Jan 31 2025 04:19:31
Module start 'content'
Timing: Jan 31 2025 04:19:31
Module end 'content'
Timing: Jan 31 2025 04:19:31
Script end

Main resources:

Total runtime0.0151 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.3906151.2422
Module start 'layout' 0.00500.0026 739.632836.7109
Module start 'content' 0.00760.0058 776.343890.2188
Module end 'content' 0.01340.0017 866.562533.9922
Script end 0.0150  900.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002415.7822140.0002
Check MTime0.00117.1046140.0001
Mysql Total
Database connection0.00074.866010.0007
Mysqli_queries0.002516.468330.0008
Looping result0.00000.079010.0000
Template Total0.00128.010.0012
Template load0.00096.028010.0009
Template processing0.00031.942910.0003
Override
Cache load0.00064.176710.0006
General
dbfile0.002013.070980.0002
String conversion0.00000.052240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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