eZ Community » Forums » Developer » access denied
expandshrink

access denied

access denied

Friday 24 October 2014 9:15:11 am - 3 replies

Hi ,

 

I have created a php called getfavourites.php and calle it in the module like below and add that to site.ini.append.but it gives an error saying acess denied.Any one have some idea ? Please help.

 

$ViewList['getfav'] = array(        'script' => 'presentation/Favourites/addFavourites.php',        'function' => array(''),        'params' => array());

Friday 24 October 2014 9:42:48 am

Hello upeksha,

You probably need to define a module view function name (you have empty string now which is wrong).

Use bccie extension as an example: 

https://github.com/brookinsconsulting/bccie/blob/master/modules/bccie/module.php#L51

https://github.com/brookinsconsulting/bccie/blob/master/modules/bccie/module.php#L58

You also need ModuleList ini settings and again use bccie as an example: https://github.com/brookinsconsulting/bccie/blob/master/settings/module.ini.append.php#L5

And lastly and most importantly you need to use the admin to assign role permissions for your module view.

http://share.ez.no/layout/set/print/learn/ez-publish/adding-custom-security-policy-limitations-to-your-modules

https://doc.ez.no/eZ-Publish/Technical-manual/4.x/Features/Policy-functions

I hope this helps!

Cheers,
Heath 

Friday 24 October 2014 1:34:54 pm

Thank you.I have learned new  things from your' post.But my problem is still there. I have tried out everything you mentioned.

Things i am doing in site.ini.append not affecting in admin. Its giving  an error saying "Access Denied for this module"

 

       $ViewList['getfav'] = array(        'script' => 'presentation/Favourites/getFavourites.php',        'function' => array('getfav')                           );

Modified on Friday 24 October 2014 1:47:59 pm by upeksha ranawaka

Friday 24 October 2014 10:38:10 pm

Hello upeksha,

You should post your whole and complete module.php, 'presentation/Favourites/module.php'.

Because from what your showing me your missing a lot of required code! Your code should look something more like this ..

// Define module name
$Module = array( 'name' => 'Favourites Module' );
 
// Define module view and parameters
$ViewList = array();
 
// Define getfav module view and parameters
$ViewList['getfav'] = array( 'script' => 'presentation/Favourites/addFavourites.php', 'function' => array('getfav'), 'default_navigation_part' => 'favouritesnavigationpart', 'params' => array( 'ObjectID' ), 'unordered_params' => array() );
 
 $FunctionList['getfav'] = array();

upeksha to be able to better help you would you consider posting more of your custom module configuration? We need it to be able to ensure your doing everything correctly.

You should also share your extension module.ini settings file here in the forums so we can ensure it is correct.

You should also share your site.ini.append since you keep making reference to it so we can make sure everything is correct.

You should also share your settings/override/site.ini.append.php file to ensure that you are activating your custom extension correctly!

[ExtensionSettings]
ActiveExtensions[]=yourCustomExtensionName

You should also post a screenshot of your role permissions for your anonymous role so we can ensure that you have set the right module view permissions. You hint that you have done this but I don't think that you have (or could have) since your code is still not quite right.

It might be simpler to simply post your custom module as a github.com repository so we can see everything we need to review quickly (since posting code snippets here in the forums is slow, inaccurate and time consuming) .

I hope this helps!

Cheers,
Heath 

Modified on Friday 24 October 2014 10:45:02 pm by // Heath

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from