Forums / Setup & design / Change user policies / group via an automated script + mySQL

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 :)

eZ debug

Timing: Jan 31 2025 01:14:59
Script start
Timing: Jan 31 2025 01:14:59
Module start 'content'
Timing: Jan 31 2025 01:14:59
Module end 'content'
Timing: Jan 31 2025 01:14:59
Script end

Main resources:

Total runtime0.0303 sec
Peak memory usage6,144.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.1875370.2578
Module start 'content' 0.00710.0158 958.44531,001.6250
Module end 'content' 0.02280.0074 1,960.070370.7031
Script end 0.0302  2,030.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00268.5850120.0002
Check MTime0.00103.3328120.0001
Mysql Total
Database connection0.00082.620610.0008
Mysqli_queries0.00247.829440.0006
Looping result0.00000.043320.0000
Template Total0.007023.010.0070
Template load0.00092.895510.0009
Template processing0.006120.102610.0061
Override
Cache load0.00061.995810.0006
General
dbfile0.005518.3330100.0006
String conversion0.00000.016530.0000
Note: percentages do not add up to 100% because some accumulators overlap

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