Share » Learn » eZ Publish » Adding custom security policy...

Adding custom security policy limitations to your modules

Tuesday 25 May 2010 7:44:59 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Defining module functions to limit access to them

It is obviously possible to define security rules, configurable in the same way, for our own modules. All we need to do is to create a list of functions for our module, in module.php.

extension/myextension/modules/mymodule/module.php :

$Module = array('name' => 'mymodule');

$ViewList = array();
$ViewList['myview'] = array(
    'script'                    => 'view.php',
    'params'                    => array(),
    'functions'                    => array( 'myfunction' )

$FunctionList['myfunction'] = array();

Here we define a function for the module mymodule and we affect it to the view myview. This function will display in the corresponding list when creating a new security policy for module mymodule in the admin interface. You will find this kind of definition in most of modules contained in the kernel, or within extensions developped by eZ Systems or by the community (this is the case for NovenINIUpdate extension).

What I described above is sufficient in most cases, but what if we need to add more complex limitations like in content module (language, section, etc...) ?

36 542 Users on board!

Tutorial menu


Printer Friendly version of the full article on one page with plain styles