Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6169901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:56:13+00:00 2026-05-23T22:56:13+00:00

I need a system that will allow users to modify data that is related

  • 0

I need a system that will allow users to modify data that is related to them.

Like a shopping center, with several stores and a shared catalog.
I want the stores to be able to edit and add items, from and in, the global pool. but i want to limit the access of a store to its own items.

how it is done with acl & auth (the concept of course)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:56:14+00:00Added an answer on May 23, 2026 at 10:56 pm

    I’ve seen this question a few times. From the cake’s doc it says:

    Access control lists, or ACL, handle two main things: things that want
    stuff, and things that are wanted.

    so in theory, you could handle all the items in your application using ACL, but I see a few problems doing that:

    • lets say you have 10k elements per store in your items table, well, you’ll have the same amount of elements in your ACO table. Now if you add a user, you’ll have to give him access to the items in the ARO_ACO table (another 10k items FOR EACH USER!)
    • .. ok maybe I exaggerated on the first example. Because you could group the items and in the ACO table, and only set the permissions per group in the ACO_ARO table. But now it might be a nightmare to make the queries in your application, imagine if you want to make a filtered paginated list of items. You’d have to ask the ACO (which now is in a tree structure) and the ARO_ACO table to count and paginate the items… and even if it’s done automatically you’d have a performance problem

    In my opinion, it’s better to use the ACL to only grant permission to the controllers methods (CRUD) and manage the item permissions in your code by setting the condition in your queries:

    $this->Items->find('all',array('conditions'=>array('store_id'=>$this->Auth->user('store_id'))))
    

    But you might need to repeat this condition everywhere so you could create a Behavior that will modify the queries in order to add a condition in the WHERE clause, so you would always return/edit the items of the current store. For example, create a behavior like this:

        /** 
         * Filter query conditions with the correct `type' field condition. 
         */ 
        function beforeFind(&$model, $query) 
        {
            /**
             * Condition for the paginators that uses joins
            */
            if(isset($query['joins']) && !empty($query['joins'])){
                foreach($query['joins'] as $key => $joinTable){
                    if(ClassRegistry::init($joinTable['alias'])->hasField('store_id')){
                        $query['joins'][$key]['conditions'][] = $joinTable['alias'].".store_id = '".$_SESSION['store_id']."'";
                    }
                }
            }
    
            /**
             * condition for the normal find queries
            */
            if($model->hasField('store_id') && $model->name != "User"){
                $query['conditions'][$model->name.'.store_id'] = $_SESSION['store_id'];
            }
            return $query;
        }
    

    In the controller I’d just need to call the find method normally

    $this->Items->find('all');
    

    This way you don’t have to make more queries to see if the user can access an item. I’ve used something like this on a website and it works fine for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok need some help, I have a system I'm creating that will allow users
I need to setup a simple IVR system for a friend's company that will
I'm building a system that need to collect some user sensitive data via secured
I have been task with (ha) creating an application that will allow the users
My friend and I are writing an C# IRC Bot that will allow users
I need to create a file that will be used to store confidential data;
I have the need to create a plugin system that will have dependency support
I am working on a site that will allow users to create an account.
I'm in need of a distributed file system that must scale to very large
I need to set a system environment variable from a Bash script that would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.