Post by sliux » Sat May 02, 2009 6:19 pm

Hello,

I want to hide admin menu items, to which current user hasn't access permission. Any ideas, how to implement this?

Solution is found on this page http://forum.opencart.com/viewtopic.php?p=97682#p97682 in this topic.
Last edited by i2Paq on Sun Sep 12, 2010 8:39 pm, edited 2 times in total.
Reason: Topics merged + title changed

Newbie

Posts

Joined
Sat May 02, 2009 6:15 pm

Post by xyligan » Wed May 06, 2009 3:43 am

Ideas? It`s not so easy first.
Programmer have to create special module.
In a few words you have to check role of user (you have administrator and customers in db) and show
corresponding menu items, so you have to rebuild menu architecture, add field with information to wich of roles it must be shown.

User avatar
New member

Posts

Joined
Tue May 05, 2009 6:29 pm

Post by sliux » Fri May 08, 2009 4:52 am

xyligan wrote: Programmer have to create special module.
What do you mean saying module? I'm new to opencart and still learning the source, but so far I didn't saw ability, to attach custom module or plugin to desired controller. Am I wrong?

Newbie

Posts

Joined
Sat May 02, 2009 6:15 pm

Post by xyligan » Fri May 08, 2009 11:33 pm

Learn more admin menu
all that there.

User avatar
New member

Posts

Joined
Tue May 05, 2009 6:29 pm

Post by rochester » Tue Jul 06, 2010 3:25 am

Hi,

I'm working with user groups and I need to hide the options that the user can't access (e.g. Catalog -> Products). I've searched the DB but my solution is pretty complex, I need one simpler. ;D

Anyone have any idea?

Thks

--
Rochester Oliveira


Active Member

Posts

Joined
Thu Jul 01, 2010 2:15 am

Post by rochester » Tue Jul 06, 2010 4:02 am

I've done in the complex way. Thank you!

--
Rochester Oliveira


Active Member

Posts

Joined
Thu Jul 01, 2010 2:15 am

Post by jknutsen » Mon Jul 19, 2010 1:25 am

How did u do it?

Image
http://www.bluebell.no/order/whmcs/aff.php?aff=001
Kun 999,- i året inklusiv domene.


User avatar
New member

Posts

Joined
Sun Feb 07, 2010 12:23 am
Location - Skoppum, Norway

Post by jknutsen » Mon Jul 19, 2010 1:28 am

Hello, I have to to hide the admin options, that a user hasnt got rights to. So if I like dont have rights to the whole settings page, it wont be shown.

Image
http://www.bluebell.no/order/whmcs/aff.php?aff=001
Kun 999,- i året inklusiv domene.


User avatar
New member

Posts

Joined
Sun Feb 07, 2010 12:23 am
Location - Skoppum, Norway

Post by cmebd » Mon Jul 19, 2010 2:58 am

In Admin go to:

System>Users>User Groups - there you can create a group with the necessary options for editing. You can use the Demonstration user to test out your permissions for Access and Modify there.

Hope this has helped

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by Xsecrets » Mon Jul 19, 2010 6:43 am

yes, but that won't hide the options, it will just give a permissions error when a user that doesn't have permissions tries to access it. There are currently no mods that actually hide it. A mod that hides stuff from there probably wouldn't be too hard to write, but he also mentioned not having access to certain settings, and that would require some major rewrites to make it that granular.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by cmebd » Mon Jul 19, 2010 3:54 pm

Tks for verifying.

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by danielhpavey » Tue Aug 10, 2010 10:39 pm

Sorry if this one has been asked before...

Does anyone know of a way to hide admin menu items that a user does not have permission to access?

I know I can edit the header file, but this would then need editing again if permissions are changed

And I don't want to confuse my users with menu items shown that they cannot access

Thanks

Newbie

Posts

Joined
Tue Aug 10, 2010 10:35 pm

Post by JAY6390 » Tue Aug 10, 2010 11:12 pm

You could check for each individual item and echo the item if the user has permission, but would take quite a bit of editing to achieve

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Xsecrets » Wed Aug 11, 2010 12:14 am

yes it's unfortunate that Daniel is so against having the menu's built from the database. It would make it easy to add a user groups field, and allow mod makers to add menu items without having to edit the header files.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by JAY6390 » Wed Aug 11, 2010 12:27 am

Yeah my thoughts exactly. This can of course also be cached to reduce DB queries required to generate it

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Studio-Owens » Fri Sep 10, 2010 8:39 am

Actually this wasn't too bad. Took about 15 minutes. OpenCart already had the needed functions, it was just about using them.

I only had to add checks on each <li> using the function hasPermission(). If the admin user has access permission then the list item is shown (the if block is executed). On parent menu items I checked to see if the admin user had access to any of the children items (Products is the child of Catalog for example). If it did then the parent list item is shown. If not then the parent list item is skipped.

I attached the modified header.tpl file with the above modifications (it is from version 1.4.9).

The attached file replaces:
admin/view/template/common/header.tpl

Attachments

This is a vQmod file for hiding menu items for OpenCart version 1.5.1.1

Header Template modified to use hasPermission to access.

Last edited by Studio-Owens on Thu Aug 11, 2011 6:08 am, edited 5 times in total.

Image
www.Studio-Owens.com


User avatar
Newbie

Posts

Joined
Fri Jun 04, 2010 5:00 am

Post by danielhpavey » Fri Sep 10, 2010 5:58 pm

Thanks for the help

It's genuinely appreciated

Newbie

Posts

Joined
Tue Aug 10, 2010 10:35 pm

Post by Studio-Owens » Sun Sep 12, 2010 6:31 am

jknutsen wrote:How did u do it?
Try this solution here: http://forum.opencart.com/viewtopic.php?p=97682#p97682

Image
www.Studio-Owens.com


User avatar
Newbie

Posts

Joined
Fri Jun 04, 2010 5:00 am

Post by Studio-Owens » Sun Sep 12, 2010 6:32 am

sliux wrote:Hello,

I want to hide admin menu items, to which current user hasn't access permission. Any ideas, how to implement this?
Here is the solution for hiding the menu items to which the user shouldn't have access, including a header.tpl file that has already been modified:
http://forum.opencart.com/viewtopic.php ... t=0#p97682

Image
www.Studio-Owens.com


User avatar
Newbie

Posts

Joined
Fri Jun 04, 2010 5:00 am

Post by Studio-Owens » Sun Sep 12, 2010 6:38 am

Xsecrets wrote:yes, but that won't hide the options, it will just give a permissions error when a user that doesn't have permissions tries to access it. There are currently no mods that actually hide it. A mod that hides stuff from there probably wouldn't be too hard to write, but he also mentioned not having access to certain settings, and that would require some major rewrites to make it that granular.
If you are talking about hiding the admin menu items that a user doesn't have access permission for then your answer is to modify the header.tpl. Here is how to do it, with an attached modified header.tpl:
http://forum.opencart.com/viewtopic.php?p=97682#p97682

Image
www.Studio-Owens.com


User avatar
Newbie

Posts

Joined
Fri Jun 04, 2010 5:00 am
Who is online

Users browsing this forum: No registered users and 22 guests