We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Vokuro ACL Permissions Issue

Hi all,

I've been playing around with vokuro and wanted to turn the application into a multi site, multi user framework as apposed to a single site, multi user framework. I've made some good progress by adding a key to each table and managed to get this working for 90% of the site. Now I have faced a permissions issue which I cant seem to resolve, when I have 2 sites (keys) listed within the profiles table then the acl is creating the datatext using all profile names regardless of my key (which I think is correct), however when the permissions are then read back out there is a problem. I believe if the profile name is the same for both of my keys then this is where the issue occurs as the ControllerBase.php is unable to differentiate which key the permissions belong to. I tried adding my key to the ACL before the data.txt is created but this then limits the profile to the last saved by any key and did not work, which leads me to believe that there must be a way to pull the correct permissions for the correct key after the data.txt has been created.

As I'm not sure what code is needed and where to add this to make the function work any help would be appreciated. Additionally if there is a better way to achieve what I am trying to do then any suggestions would be great.

Thank you in advance, really appreciate any help as this has been bugging me for a few days.



5.1k
edited Jul '17

hi

To separate acl by site, You can try to do something like this :


    protected function getFilePath($site)
    {
        if (!isset($this->filePath)) {
            $this->filePath = $this->config->application->cacheDir . '/acl/' . strtolower($site) . 'data.txt';
        }
        return $this->filePath;
    }

Always use this function to get cache file path or $this-filephath

if the user can change site, you have to unset object attributes private acl and private filepath.

you can also store site in attribute and check if it not same in this function

good luck

brill thank you