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

Wednesday, January 5, 2022

[FIXED] CakePHP page restriction interface

 January 05, 2022     cakephp, cakephp-3.0, php     No comments   

Issue

I have multiple user access groups and I am currently using this code to restrict user access groups from certain pages.

public function add()
    {
        if($this->request->session()->read('Auth.User.access_id') != '1 ')
            {
                //$this->request->session()->setFlash('You are not authorized to visit this page','flash',array('alert'=>'info'));
                $this->redirect('/dashboard');
            }

I want to be able to create an opencart type interface for allowing access for different pages for each user access groups.

Opencart Image Example

So I want to create check boxes to modify access so that admins can easily create new user access groups and modify existing ones without touching the code. The only way I can think to do this is for the check boxes to modify the code for every controller. Would someone suggest a way to do this?


Solution

Best way to achieve that is the ACL plugin.

https://github.com/cakephp/acl

This is how I use it (is in italian) 1]



Answered By - David A.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

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