Improved site access matching

Author Message

Jan Borsodi

Wednesday 29 October 2003 2:20:00 am

Currently the site access matching system is more complex than it needs to be, for instance it consists of too many separate settings.
Also the PHP code that does the matching is hard to read and has already had several bugs (It's better in 3.2-3 and 3.3 thanks to Volker Lenz)

I propose to create a totally new matching system which will solve this problems as well as make the system more flexible.

1. The matching
Instead of having 5-10 settings for determing how to match I propose a simple list/array of matching rules.
Each rule will try to match and if it does returns a site access name, that name is checked against valid site accesses.
If the site access is valid it used if not the next rule is checked.

a) host

SiteAccessMatch[]=hostmap:www.example.com=user
SiteAccessMatch[]=hostmap:admin.example.com=admin

This has two rules which matches against a hostname an designates it a site access.

SiteAccessMatch[]=hostelement:3

Fetches the text from the third element in the hostname and uses it as the site access. eg. www.example.com, here the first element is com and the third is www.

SiteAccessMatch[]=hostregexp:(.+).www.example.com:1

Matches the hostname against a regexp and returns the nth submatch, in this case 1.

b) port

SiteAccessMatch[]=portmap:81=admin

Maps a port number to a siteaccess.

c) path
This was currently known as URI but is really just the path element.

SiteAccessMatch[]=pathelement:1

Fetches the nth element of the path (separated by /) and uses that as siteaccess name.

SiteAccessMatch[]=pathregexp:^([^/]+)/:1

Matches the path against a regexp and returns the nth element.

d) url

SiteAccessMatch[]=urlmap:http://www.example.com=user
SiteAccessMatch[]=urlmap:https://www.example.com=admin

Maps against the whole request url and maps it to a site access.

SiteAccessMatch[]=urlregexp:https?://([^.]+).example.com:1

Matches the url against a regexp and uses the nth match as the site access.

2. Compatability

The old code should be moved to a new file and a new setting in site.ini should be added.
That way it's possible to call the old code if you don't want to change your existing settings.

Also all new settings should be placed in a new .ini (e.g. access.ini) file.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

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 18 2025 15:09:29
Script start
Timing: Jan 18 2025 15:09:29
Module start 'layout'
Timing: Jan 18 2025 15:09:29
Module start 'content'
Timing: Jan 18 2025 15:09:30
Module end 'content'
Timing: Jan 18 2025 15:09:30
Script end

Main resources:

Total runtime0.6073 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.3438152.6250
Module start 'layout' 0.00540.0036 741.968839.4453
Module start 'content' 0.00900.5966 781.4141475.8906
Module end 'content' 0.60570.0016 1,257.30478.1641
Script end 0.6073  1,265.4688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.5269160.0002
Check MTime0.00130.2216160.0001
Mysql Total
Database connection0.00080.138110.0008
Mysqli_queries0.559292.0825460.0122
Looping result0.00040.0724440.0000
Template Total0.577595.120.2887
Template load0.00190.312320.0009
Template processing0.575694.771820.2878
Template load and register function0.00010.016810.0001
states
state_id_array0.00090.152010.0009
state_identifier_array0.00100.167520.0005
Override
Cache load0.00160.2576380.0000
Sytem overhead
Fetch class attribute can translate value0.00070.109210.0007
Fetch class attribute name0.00060.105420.0003
XML
Image XML parsing0.00050.080210.0005
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00060.1056170.0000
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs