Forums / Developer / Extending the content module

Extending the content module

Author Message

Bruce Morrison

Sunday 07 September 2003 10:27:22 pm

I'm in the process of adding a custom search to a site. I've written the search functionality as a new module but have realised that this is not what I want to do. I need to extend the existing "content" module so I can access and honour the permissions in place on the content.

Is it possible to do this using the extension system or will I have to modify the kernel/content/... directories?

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

Jan Borsodi

Monday 08 September 2003 12:20:50 am

I don't know all the details of what you want to do but it sounds like you need to modify the kernel/content files.

--
Amos

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

Bruce Morrison

Monday 08 September 2003 12:33:49 am

Hi Jan

I want to be able to extend the system but for the content modules read permissions to be honoured. It struck me that because the permissions are module based I would have to extend the existing content module to use these permissions. I cannot just add a module extension as this would be a new module and have it's own set of permissions.

Is there any way to "import" the content modules limitation list into my new module. I really really really don't want to modify the core distributiuon if at all possible.

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

Bruce Morrison

Monday 08 September 2003 9:48:37 pm

I ended up importing the policies for content, read with the following code (from index.php)

// Import the permissions for the content module as that these can be honoured
include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );
$currentUser =& eZUser::currentUser();
$accessResult = $currentUser->hasAccessTo( 'content' , 'read' );
$params['Limitation'] =& $accessResult['policies'];
$GLOBALS['ezpolicylimitation_list'] =& $params['Limitation'];

$limitationList = array();
if ( isset( $GLOBALS['ezpolicylimitation_list'] ) )
{
$policyList =& $GLOBALS['ezpolicylimitation_list'];
$limitationList = array();
foreach( array_keys( $policyList ) as $key )
{
$policy =& $policyList[$key];
$limitationList[] =& $policy->attribute( 'limitations' );
}
}

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