Post by 64057 » Thu Oct 20, 2016 11:14 pm

hello everyone

i just deleted admin privileges by mistake on opencart panel. and whenever i log in admin on panelit just shows dashboard. nothing else.
so checked phpmyadmin oc_user group and oc user and its looking as it would be.
so i think i have to do something on ftp please someone! illuminate me

Newbie

Posts

Joined
Thu Oct 20, 2016 9:21 pm

Post by Johnathan » Fri Oct 21, 2016 11:26 pm

Log in using FTP, and then make this edit:

Code: Select all

IN:
/system/library/user.php OR /system/library/cart/user.php

AFTER:
public function hasPermission($key, $value) {

ADD:
return true; 
That will enable all areas for all users, so you can then go to your admin panel and re-save the permissions in Users > User Groups. Don't forget to remove the edit after you've done that, or permissions will not be checked at all.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by frishops » Mon Jul 10, 2017 5:30 am

Hey, thanks a lot. this just helped me!

Image

Your Local Store.
http://www.frishops.ca
http://www.frishops.cn


New member

Posts

Joined
Tue Sep 15, 2015 5:58 am
Location - Quebec, Canada

Post by myanno » Tue Oct 10, 2017 10:38 am

i can't solved my problem , please help

Newbie

Posts

Joined
Wed Sep 06, 2017 2:32 pm

Post by Johnathan » Tue Oct 10, 2017 10:36 pm

Is this related to admin permissions? If so, you need to follow the steps I've outlined above. If you can't, then you should ask someone you know who could do it for you, or hire someone to fix the issue.

If this isn't related to admin permissions, then post a new topic.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by mrblond » Wed Oct 18, 2017 11:44 pm

Hi,
can you please clarify where exactly to put return true; in the code you specified:

Code: Select all

public function hasPermission($key, $value) {
		if (isset($this->permission[$key])) {
			return in_array($value, $this->permission[$key]);
		} else {
			return false;
		}
	}

Active Member

Posts

Joined
Fri Oct 13, 2017 4:43 pm

Post by Johnathan » Wed Oct 18, 2017 11:57 pm

After this line:

Code: Select all

public function hasPermission($key, $value) {

You add a new line with this code:

Code: Select all

return true; 

Don't forget to remove the line you added after you're able to re-save your permissions.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by pixelhaus » Mon Feb 12, 2018 6:07 pm

Hi there,
I'm having a similar issue after a client removed his permissions. I've added the extra line (as shown in the screenshot) to system/library/cart/user.php (v2.3.0.2) but it's not making any difference. Is there anything else I might have missed ?
Image

New member

Posts

Joined
Mon Sep 26, 2011 3:57 pm

Post by Johnathan » Tue Feb 13, 2018 11:27 pm

If you have an ocMod that affects that file, the edit won't activate until you refresh your ocMod cache in Extensions > Modifications.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by sameverything » Mon Jul 30, 2018 8:37 am

Johnathan wrote:
Wed Oct 18, 2017 11:57 pm
After this line:

Code: Select all

public function hasPermission($key, $value) {

You add a new line with this code:

Code: Select all

return true; 

Don't forget to remove the line you added after you're able to re-save your permissions.
Hi, Thanks for this

I too by accident deleted my admin permissions, I am on OpenCart 3
I added the line on cart/user.php
And now I can Select All permissions, and Save, with no issues, however, it is not really "saved"
Once I revisit the User Group permissions, all the vital permissions are unchecked.
I tried refreshing and clearing mods etc.

Any suggestions?

Thanks
Sam

Newbie

Posts

Joined
Mon Oct 16, 2017 1:00 am

Post by Johnathan » Tue Jul 31, 2018 10:47 pm

Sounds like you have something more going on, then. I'd suggest uninstalling any mods you have installed (especially ones with ocMod or vQmod files, since those are likely to be the cause) and see if that helps.

If not, you may need to hire someone to take a look for you. If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Moel » Fri Sep 13, 2019 12:19 pm

Johnathan wrote:
Wed Oct 18, 2017 11:57 pm
After this line:

Code: Select all

public function hasPermission($key, $value) {

You add a new line with this code:

Code: Select all

return true; 

Don't forget to remove the line you added after you're able to re-save your permissions.
This code helping, but all permission become enable with or without checking the lists. Any suggestion how to make permission can be arrangeable like opencart normally do without error issue?

Newbie

Posts

Joined
Sat Feb 16, 2019 5:48 am

Post by SVN » Thu Jan 28, 2021 1:46 am

Johnathan wrote:
Tue Jul 31, 2018 10:47 pm
Sounds like you have something more going on, then. I'd suggest uninstalling any mods you have installed (especially ones with ocMod or vQmod files, since those are likely to be the cause) and see if that helps.

If not, you may need to hire someone to take a look for you. If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.
I had the same problem and added the line in USER.PHP, I could login, I cleared the cache from OCMOD and now I get an ERROR500 when I try to go to my admin page. I deleted the link in USER.PHP again but still I get the error when going to www......com/admin. What can I do, I can't login anymore...

User avatar
SVN
Active Member

Posts

Joined
Mon Jan 03, 2011 11:59 pm

Post by straightlight » Thu Jan 28, 2021 1:54 am

I had the same problem and added the line in USER.PHP, I could login, I cleared the cache from OCMOD and now I get an ERROR500 when I try to go to my admin page. I deleted the link in USER.PHP again but still I get the error when going to www......com/admin. What can I do, I can't login anymore...
Error logs.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by SVN » Thu Jan 28, 2021 4:02 pm

straightlight wrote:
Thu Jan 28, 2021 1:54 am
I had the same problem and added the line in USER.PHP, I could login, I cleared the cache from OCMOD and now I get an ERROR500 when I try to go to my admin page. I deleted the link in USER.PHP again but still I get the error when going to www......com/admin. What can I do, I can't login anymore...
Error logs.
So my frontpage works normal, only when I go to my admin page I get this error.

Parse error: syntax error, unexpected 'if' (T_IF) in /home/users/system/storage/modification/system/library/cart/user.php on line 73

public function hasPermission($key, $value) {
if (isset($this->permission[$key])) {
return in_array($value, $this->permission[$key]);
} else {
return false;
}


These are te only log lines since yesterday.
2021-01-27 12:07:33 - PHP Notice: Undefined index: product_id in /home/users/catalog/controller/extension/module/ianalytics.php on line 83
2021-01-27 15:39:32 - PHP Notice: Undefined index: custom_h1 in /home/users/vqmod/vqcache/vq2-system_storage_modification_catalog_controller_product_category.php on line 123

User avatar
SVN
Active Member

Posts

Joined
Mon Jan 03, 2011 11:59 pm

Post by xxvirusxx » Thu Jan 28, 2021 6:08 pm

Contact extension/module developer support.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by lockbox » Mon Apr 25, 2022 4:50 pm

Johnathan wrote:
Wed Oct 18, 2017 11:57 pm
After this line:

Code: Select all

public function hasPermission($key, $value) {

You add a new line with this code:

Code: Select all

return true; 

Don't forget to remove the line you added after you're able to re-save your permissions.

Newbie

Posts

Joined
Sat May 28, 2016 11:15 am
Who is online

Users browsing this forum: No registered users and 64 guests