PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 16, 2022

[FIXED] How to Set Permission for Dashboard in Opencart for certain users?

 October 16, 2022     admin, dashboard, opencart, user-permissions     No comments   

Issue

I am using Opencart 1.5.6.4 I am able to set Permissions to All other pages but I am not getting option to set permission to set permission for dashborad or common/home.

I am trying follow link http://forum.opencart.com/viewtopic.php?t=32561

But I am not able to get options to set permission.


Solution

I found the answer. To HIDE Dashboard from certain users following are the steps we need to take.

Open admin\controller\user\user_permission.php

FIND

$ignore = array('common/home',
                  'common/startup',
                  'common/login',
                  'common/logout',
                  'common/forgotten',
                  'common/reset',                                             
                  'error/not_found',
                  'error/permission',
                  'common/footer',
                   'common/header'
                  );

REMOVE 'common/home',

Create XML file and add under vqmod xml folder.

<modification>

                <id>Add a permission check to the admin dashboard, and provide with an alternate forwarding target</id>
                <version>1.0.0</version>
                <vqmver>1.0.2</vqmver>
                <author>ckonig</author>

                <file name="admin/controller/user/user_permission.php">

        <operation>
            <search position="replace">
                                                                <![CDATA['common/home',]]>
                                                </search>
            <add>
                                                                <![CDATA[]]>
                                                </add>
        </operation>
                </file>

                <file name="admin/view/template/common/home.tpl">

        <operation>
            <search position="after">
                                                                <![CDATA[<?php echo $header; ?>]]>
                                                </search>
            <add>
                                                                <![CDATA[
                                                                <?php
                                                                if(!$this->user->hasPermission('access','common/home')){
                                                                                $this->redirect('index.php?token='.$token.'&route=catalog/product');
                                                                }
                                                                ?>
                                                                ]]>
                                                </add>
        </operation>
                </file>
</modification>

NEXT SET Permission



Answered By - Ashish Agarwal
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing