Use function limitations in my own module.

Author Message

Paul Etienney

Wednesday 10 March 2010 8:26:06 am

Hi,
I am creating my own module. I defined a function limitation (the Owner one) but i do not know how to use it in my view.
Any clue ? Any link ?
Thank you very much.
PaulHi,
I am creating my own module. I defined a function limitation (the Owner one) but i do not know how to use it in my view.
Any clue ? Any link ?
Thank you very much.
Paul

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Paul Etienney

Thursday 11 March 2010 9:32:15 am

Hi again,

I had the same discussion on linkedin in the ez Ecosystem group. (i recommand this group is lively and i had in the past good help). Here are the discussion we had.

-------------------------------------------------------------------------------------- From Felix Woldt :

hi, you have to define the function limitiation in module.php In the example at the following link it ist 'functions' => array( 'read' ), ... $FunctionList['read'] = array(); http://share.ez.no/articles/ez-publish/an-introduction-to-developing-ez-publish-extensions/(page)/4 Felix

-------------------------------------------------------------------------------------- From me :

Hi Felix, Thank you for your answer. Actually, I have already defined my functions and my function limitations in module.php. I would like to create this policy : "You can change the owner of this objects IF you are the actual owner.". Any idea ? $ViewList["ownerchange"]= array( 'functions' => array( 'ownerchange' ), 'script' => 'ownerchange.php', 'params' => array('ObjectId') ); $Assigned = array( 'name'=> 'Owner', 'values'=> array( array( 'Name' => 'Self', 'value' => '1') ) ); $FunctionList = array(); $FunctionList['ownerchange'] = array('Owner' => $Assigned);

-------------------------------------------------------------------------------------- From Felix Woldt :

i understood, the standard ez permission check implements only your_module/ownerchange you defined a subset 'Owner' This configuration you have to check by yourself in you module_view 'ownerchange'

-------------------------------------------------------------------------------------- From me :

Thank you again. This is what i am trying to do. I will do the owner id check by myslef but i do not know how to access to the current user permissions inside my own module.

-------------------------------------------------------------------------------------- From Kristof Coomans :

The current user you can retrieve with eZUser::currentUser(), Then on the returned object, you can call the method hasAccessTo(), seehttp://pubsvn.ez.no/doxygen/4.2/html/classeZUser.html#ee29e5e1065c6b68132bb6c665a8f3dbThe return value will contain a list of the applied policy function limitations, if any.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

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 30 2025 00:52:53
Script start
Timing: Jan 30 2025 00:52:53
Module start 'layout'
Timing: Jan 30 2025 00:52:53
Module start 'content'
Timing: Jan 30 2025 00:52:53
Module end 'content'
Timing: Jan 30 2025 00:52:53
Script end

Main resources:

Total runtime0.0129 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.0042 588.2656151.2266
Module start 'layout' 0.00420.0019 739.492236.6797
Module start 'content' 0.00610.0055 776.171994.3750
Module end 'content' 0.01160.0013 870.546933.9922
Script end 0.0129  904.5391 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002217.0472140.0002
Check MTime0.00107.6114140.0001
Mysql Total
Database connection0.00064.406510.0006
Mysqli_queries0.001914.432130.0006
Looping result0.00000.062710.0000
Template Total0.00107.810.0010
Template load0.00085.998810.0008
Template processing0.00021.754510.0002
Override
Cache load0.00054.142910.0005
General
dbfile0.001612.629780.0002
String conversion0.00000.036940.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