Jump to content

New custom controller access denied


vinaysaini

Recommended Posts

I have not created any menu. It is just a link with my new controller link {$link->getAdminLink('AdminCustomOrders')|escape:'html':'UTF-8'}

 

I need to use some of the functionality of existing order controller. So I have copied AdminOrdersController controller  and pasted in override folder with name changed to AdminCustomOrders and class name also I have changed to AdminCustomordersControllerCore. 

 

So the code is same as orders controller. Now it shows me access denied. 

 

I can give view access by putting new function in the controller, like below.

public function viewAccess($disable = false)
	{
		return true;		
	}

But now the problem occurs with edit,delete or some other access. And I can not give permission through Administration -> Permission because my controller is not appearing there.

 

So is there a good fix for it?

Edited by vinaysaini (see edit history)
Link to comment
Share on other sites

You have to add it as a Tab.

 

This is how I'm doing this (in the install part of a module):

		$tab = new Tab();
		$tab->active = 1;
		$languages = Language::getLanguages(false);
		if (is_array($languages))
			foreach ($languages as $language)
				$tab->name[$language['id_lang']] = 'Custom Orders';

		$tab->class_name = 'AdminCustomOrders';
		$tab->module = $this->name;
		$tab->id_parent = - 1;
		$tab->add();
Edited by cristic (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...