Forums / Developer / Use function limitations in my own module.

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

eZ debug

Timing: Jan 29 2025 13:30:34
Script start
Timing: Jan 29 2025 13:30:34
Module start 'content'
Timing: Jan 29 2025 13:30:34
Module end 'content'
Timing: Jan 29 2025 13:30:34
Script end

Main resources:

Total runtime0.1252 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.0056 588.0625180.8125
Module start 'content' 0.00560.0056 768.875098.1172
Module end 'content' 0.01110.1139 866.9922526.6250
Script end 0.1251  1,393.6172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00322.5262200.0002
Check MTime0.00120.9837200.0001
Mysql Total
Database connection0.00070.564110.0007
Mysqli_queries0.087069.54751410.0006
Looping result0.00090.74351390.0000
Template Total0.113790.810.1137
Template load0.00070.572110.0007
Template processing0.112990.237710.1129
Override
Cache load0.00050.409010.0005
Sytem overhead
Fetch class attribute can translate value0.00070.533810.0007
XML
Image XML parsing0.00020.156610.0002
General
dbfile0.00534.2662200.0003
String conversion0.00000.004230.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