Page 1 of 2

Hide modules

Posted: Thu Feb 26, 2015 10:21 pm
by nektar
Hello.

I have a user group called Operators.

I need to give access to these users to a specific module in Extensions. BUT i dont want them to see all the other modules that are installed.

So far their access was denied to the Extensions list. When i gave them permissions for the specific module they still couldnt access it nor the Extensions list. I then tried and gave them access to /module and /manager (access and modify) but this way they could see all the installed modules.

How can i hide all the modules I dont want them to see and only show them the specific module?

OpenCart version i use 1.5.64

Thanks in advance!!!

Re: Hide modules

Posted: Fri Feb 27, 2015 4:57 am
by IP_CAM
Did you 'group them' and set 'set' their access rights in the 'Admin / System / User / Usergroups / Whatever' ?
You probably can't make everything invisible, but at least not 'usable', but I'm not sure about this 'visible', since I never tried it yet...
Ernie
bigmax.ch/shop/

Re: Hide modules

Posted: Fri Feb 27, 2015 2:40 pm
by nektar
As i explained earlier, this group members cant use any other modules in Extension list, but they can vuew them all.

Re: Hide modules

Posted: Fri Feb 27, 2015 3:57 pm
by pprmkr
nektar wrote:I need to give access to these users to a specific module in Extensions. BUT i dont want them to see all the other modules that are installed.
To hide modules from list where user does not have acces permission.

Edit admin/controller/extension/module.php

Find:

Code: Select all

$extension = basename($file, '.php');
Add after:

Code: Select all

				if (!$this->user->hasPermission('access', 'module/'.$extension)) {
					continue;
				}
You can do the same with payment, shipping and total.

Re: Hide modules

Posted: Fri Feb 27, 2015 4:10 pm
by pprmkr
vQmod to hide modules, feeds, totals, shipping, payment if user does not have acces permission.

Re: Hide modules

Posted: Fri Feb 27, 2015 6:03 pm
by nektar
Thx guys.

I will give it a try this afternoon, when i get back to office and keep you informed.

Hope this VQmod works with opencart 1.5.64 and with future upgrade to ver 2.

Re: Hide modules

Posted: Sun Mar 01, 2015 6:47 pm
by nektar
pprmkr I havent tried the code but it should work.

I preffered the VQMod. I works as expected!!!

Where can we find this VQMod in order to upgrade it later for Opencart ver 2?

THanks again for the support!

Re: Hide modules

Posted: Sun Mar 01, 2015 9:59 pm
by pprmkr
OCMod for version 2.0.0.*

Re: Hide modules

Posted: Tue Mar 03, 2015 2:35 am
by nektar
WOW u r great mate.

Thx!

Re: Hide modules

Posted: Fri Mar 31, 2017 3:08 pm
by wonderland
I was wondering how I could make this work for OC 2.3?
I tried editing the original file by changing the path from

Code: Select all

admin/controller/extension/module.php
to

Code: Select all

admin/controller/extension/extension/module.php
But it just hides all modules, no matter the permissions.

Re: Hide modules

Posted: Fri Mar 31, 2017 4:27 pm
by nektar
Of course it does. you changed the path of the folders so it looks there admin/controller/extension/extension/module.php where there are no modules.

Re: Hide modules

Posted: Fri Mar 31, 2017 5:23 pm
by wonderland
It points to the same file and targets the same code line as in original mod though. If I understand correctly OC 2.3 changed module layout and file structure a little bit.

Besides, in the newest OC version there is no module.php file in the original modification path

Code: Select all

admin/controller/extension/module.php

Re: Hide modules

Posted: Sat Aug 04, 2018 12:03 am
by mehrshid
pprmkr wrote:
Sun Mar 01, 2015 9:59 pm
OCMod for version 2.0.0.*
It working fine also with OC 3.0.2
But a question : Is there any way to hide an extension in extension list?

Re: Hide modules

Posted: Thu Dec 12, 2019 7:04 pm
by Renecek
doesn't work with OC 3.0.2.0.
Any update please?

Re: Hide modules

Posted: Fri Dec 13, 2019 1:53 am
by xxvirusxx
Renecek wrote:
Thu Dec 12, 2019 7:04 pm
doesn't work with OC 3.0.2.0.
Any update please?
LE: Edit: Added @pprmkr code from page 2

Re: Hide modules

Posted: Sun Jan 24, 2021 4:17 pm
by Etheravion
xxvirusxx wrote:
Fri Dec 13, 2019 1:53 am
Renecek wrote:
Thu Dec 12, 2019 7:04 pm
doesn't work with OC 3.0.2.0.
Any update please?
Could you please make one for OC2.3.0.2 and compatible with your Condor2 version?

Re: Hide modules

Posted: Sun Jan 24, 2021 4:27 pm
by xxvirusxx
Should work

Edit: Added @pprmkr code from page 2

Re: Hide modules

Posted: Sun Jan 24, 2021 5:01 pm
by Etheravion
xxvirusxx wrote:
Sun Jan 24, 2021 4:27 pm
Should work
Wow, it works! Thanks!

If you could improve the count to reflect the actual shown, that would be awesome! Nevertheless, I'm gonna buy you a beer. Cheers!
Image

Re: Hide modules

Posted: Sun Jan 24, 2021 7:50 pm
by xxvirusxx
I think involve more code.

At this moment extensions are counted by total numbers of php files

Code: Select all

$files = glob(DIR_APPLICATION . 'controller/extension/' . $extension . '/*.php', GLOB_BRACE);
Then heading_title is displayed by total numbers of files, and not based of user permissions

Code: Select all

'text' => $this->language->get('extension')->get('heading_title') . ' (' . count($files) .')',
I will think of a possibility to count only files based on user permissions.

Re: Hide modules

Posted: Sun Jan 24, 2021 8:22 pm
by Etheravion
I will think of a possibility to count only files based on user permissions.
Awesome! :D