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

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 19 2025 00:58:03
Script start
Timing: Jan 19 2025 00:58:03
Module start 'layout'
Timing: Jan 19 2025 00:58:03
Module start 'content'
Timing: Jan 19 2025 00:58:03
Module end 'content'
Timing: Jan 19 2025 00:58:03
Script end

Main resources:

Total runtime0.7055 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.1563152.6250
Module start 'layout' 0.00540.0031 741.781339.4453
Module start 'content' 0.00840.6956 781.2266603.2969
Module end 'content' 0.70400.0014 1,384.523416.1641
Script end 0.7054  1,400.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4529160.0002
Check MTime0.00140.1922160.0001
Mysql Total
Database connection0.00090.128610.0009
Mysqli_queries0.643691.2387620.0104
Looping result0.00070.0945600.0000
Template Total0.676195.820.3380
Template load0.00190.273220.0010
Template processing0.674295.563320.3371
Template load and register function0.00020.023710.0002
states
state_id_array0.00090.124310.0009
state_identifier_array0.00120.169120.0006
Override
Cache load0.00160.2252350.0000
Sytem overhead
Fetch class attribute can translate value0.00080.111030.0003
Fetch class attribute name0.00200.287570.0003
XML
Image XML parsing0.00300.430630.0010
class_abstraction
Instantiating content class attribute0.00000.002380.0000
General
dbfile0.00240.3406290.0001
String conversion0.00000.001340.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs