Forums / Developer / Permissions without modules

Permissions without modules

Author Message

Piotrek Karaś

Tuesday 03 June 2008 11:03:34 pm

Hi,

I need some sort of access/permission control over the datatypes I create, but it seems that the existing access control system is strictly based on modules and functions, and I haven't planned any...

1) Am I right about not being able to assign policies to anything else than module-related functions?
2) If so, do you think creating a module just to be able to assign some policies that will be used by datatype classes/templates would be a good idea?
3) Any other way of getting similar functionality?

Thanks!
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Bruce Morrison

Wednesday 04 June 2008 12:26:41 am

Hi Piotrek

I'm not sure what you mean when you say <i>access/permission control over the datatypes I create</i> It sounds like you are talking about content class editing? ( but that doesn't makes sense )

You can use the permission system to control other actions. I used it in my recaptcha datatype to allow some users to bypass filling in the captcha. See André R's comment:
http://ez.no/developer/contribs/applications/recaptcha_ez4

Is this the kind of thing you are after?

cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Piotrek Karaś

Wednesday 04 June 2008 1:12:03 am

Hello Bruce,

Yes, I guess this is what I mean, but just to be sure and more precise:

I'm creating a custom datatype extension, which so far hasn't required any modules.

When in content object attribute and/or content class attribute edit mode, this datatype should behave differently depending on users permissions. For example some users will be allowed to modify one of the attribute's fields, some other users will not (having those fields disabled).

Of course, I most probably will be able to find some sort of substitute condition, for example current siteaccess (if 'admin', allow changes, otherwise deny), but it seems that it would be much better to use the access control for that purpose.

I am aware of how to define the $FunctionList variable, but I haven't seen it outside of module.php files...

Thanks,
Piotrek

PS. I am pretty sure that if I add a module for this extension, I will be able to get where I want to get, it's just the question of whether creating a module just for that is necessary...

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Kristof Coomans

Wednesday 04 June 2008 2:44:13 am

Hi

http://ez.no/developer/contribs/hacks/attributeedit_policy is what you're looking for I guess. Although, the actual implementation might need some enhancements. I hope to get this incorporated soon or later in the kernel.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

eZ debug

Timing: Jan 19 2025 15:24:28
Script start
Timing: Jan 19 2025 15:24:28
Module start 'content'
Timing: Jan 19 2025 15:24:28
Module end 'content'
Timing: Jan 19 2025 15:24:28
Script end

Main resources:

Total runtime0.1791 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.0088 588.9531180.8359
Module start 'content' 0.00880.0112 769.789197.8672
Module end 'content' 0.02000.1590 867.6563526.5234
Script end 0.1790  1,394.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00351.9467200.0002
Check MTime0.00140.7736200.0001
Mysql Total
Database connection0.00180.978910.0018
Mysqli_queries0.111862.41591410.0008
Looping result0.00120.66111390.0000
Template Total0.158788.610.1587
Template load0.00090.501410.0009
Template processing0.157888.094310.1578
Override
Cache load0.00060.352810.0006
Sytem overhead
Fetch class attribute can translate value0.00070.363610.0007
XML
Image XML parsing0.00030.152410.0003
General
dbfile0.025314.1331200.0013
String conversion0.00000.008430.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