xiidea / ezRbac

A simple yet easy to implement Role Based Access Control Library for popular PHP framework Codeigniter
http://xiidea.github.io/ezRbac/
86 stars 39 forks source link

ACL Management Page Not Open #27

Closed ntperdana closed 7 years ago

ntperdana commented 7 years ago

Hi There,

I was wondering if I would get help from you . I am interested in using your module in my existing CodeIgniter based project and I have carefully followed your instructions published in https://github.com/xiidea/ezRbac. However, I always get an error after filling out the "hardtoremember" password. Please see the screenshot for the error details.

Are there any missing steps in the instructions which could possibly cause this error? Look forward to hearing from you.

Thanks in advance.

screen shot 2017-07-05 at 3 22 20 am screen shot 2017-07-05 at 3 22 11 am screen shot 2017-07-05 at 3 22 01 am
ronisaha commented 7 years ago

Could you please provide some more information. Like: Which CI version PHP version Library version.

ntperdana commented 7 years ago

Hi Roni,

Thanks for reaching out to me so prompt.

Honestly speaking, I am not an experienced developer but I was interested in using your module due to the clear installation guide. Let me try to answer your question as complete as possible.

Hope to hear from you soon.

Thanks.

Kind Regards,

Dana +6282125686505 www.cloudbanget.com Solusi Cloud Murah dan Handal, Cuma Di CloudBanget Tempatnya.

On Jul 5, 2017, at 6:24 PM, Roni Saha notifications@github.com wrote:

Could you please provide some more information. Like: Which CI version PHP version Library version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xiidea/ezRbac/issues/27#issuecomment-313075945, or mute the thread https://github.com/notifications/unsubscribe-auth/AchCcJjl2x-34-gLKfkKLbezefrFWbIKks5sK3JigaJpZM4ONqit.

ronisaha commented 7 years ago

This was a issue with PHP version 7. Has been fixed in master branch

ntperdana commented 7 years ago

Hi Roni,

I am sorry for asking again. The issue with ACL page is indeed solved in the current Master Branch. However, I do have other issue as follows. Please advise if I need to open a new thread for this.

Thanks.

Kind Regards,

Dana +6282125686505 www.cloudbanget.com Solusi Cloud Murah dan Handal, Cuma Di CloudBanget Tempatnya.

On Jul 6, 2017, at 11:30 AM, Roni Saha notifications@github.com wrote:

This was a issue with PHP version 7. Has been fixed in master branch

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xiidea/ezRbac/issues/27#issuecomment-313292283, or mute the thread https://github.com/notifications/unsubscribe-auth/AchCcKcsZlUKLDQ-l50a_7TMisF4yPuzks5sLGLegaJpZM4ONqit.

ronisaha commented 7 years ago

Please read the documentation. Feel free to ask if you need more help.

-Happy coding

ntperdana commented 7 years ago

Hi Roni,

What about the last question i asked? Any more clues you can give me? It seems that whatever permissions I check in the ACL page for Admin, I can go to a controller only when that controller has access_map function with an array containing 'index'=>'view.

Thanks in advance.

My original question:

This email is sent from my mobile device. Please accept my sincere apology for any possible typos in this email.

Kind regards,

Dana Presales Manager | Presales Dvision Mobile: +6282125686505| Email: novarica.perdana@mastersystem.co.id

On Jul 6, 2017, at 21:35, Roni Saha notifications@github.com wrote:

Please read the documentation. Feel free to ask if you need more help.

-Happy coding

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ronisaha commented 7 years ago

Once I login to the ACL page, I noticed that Role Admin has "view" access for all controllers by default.

I don't remember why but I while i designed the library in some point i set the default access for a controller which access role is not configured set to view. You can change the value in here

Then, I uncheck "view" checkbox for Admin in one controller, I add the function "access_map" in that controller (with array value: 'index'=>'view'). The result is that I can still go into that controller page even though the checkbox is unchecked.

This is also a bug for CI 3. I'll fix this on next update.

However, if I change the array value to be ('index'=>'edit') in that controller and check the "edit" checkbox and leave the "view" checkbox unchecked from the ACL page for admin, the result is I cannot go into that controller anymore. Could you please help me to understand how I should play around with these roles?

Hope the bug(s) will be fixed on next update. when i can make time(not before next two day)

Thanks for finding these issues.

Happy coding.

ntperdana commented 7 years ago

Hi Roni,

Sorry for replying again. I was about to wait, but you seem to have updated the thread.

What I understand right now is that $_default_access in libraries/Accessmap.php overrides all the settings saved in database. Meaning to say, if open up a controller, it will always use $_default_access as the permission set. How do I test it? Please look the following list:

  1. I understand that $_default_access can be configured like binary numbers. So by default, there are 5 permission, $_default_access should be configured as xxxxx where x is either 1 or 0.
  2. For testing, i use different $_default_access (1-31)to see the impact to the overall system. To my understanding, $_default_access should only be used if there are no data in the table user_access_map. But in fact, $_default_access is always used although there are permission information in the table.

Could you please point me out where I should look into to ensure that everytime a page/controller is loaded, ezRbac module will first get the permission information from the database? I think there is something missing in that.

I hope I am making myself clear to you and hope to hear from you agin. :)

Thanks.

Kind Regards,

Dana +6282125686505 www.cloudbanget.com Solusi Cloud Murah dan Handal, Cuma Di CloudBanget Tempatnya.

On Jul 7, 2017, at 9:09 AM, Roni Saha notifications@github.com wrote:

Closed #27 https://github.com/xiidea/ezRbac/issues/27 via 7b1e481 https://github.com/xiidea/ezRbac/commit/7b1e481b39e8d06f6c5124af8b3cced8a81c7a80.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xiidea/ezRbac/issues/27#event-1153780446, or mute the thread https://github.com/notifications/unsubscribe-auth/AchCcMORs6Dt8i41lRP30zaH_RwG0Adsks5sLZNHgaJpZM4ONqit.

ntperdana commented 7 years ago

Hi Roni,

Just want to give you an update, I did the following change and it seems to work. Maybe if you have time, you may verify and confirm whether this is the final fix and can be updated in the next release.

File libraries/Accessmap.php

private function get_permission($controller, $access_role = FALSE)
{
    if (!$access_role && !$this->CI->session->userdata($this->_login_session_key)) {
        echo "should not be here";
        return FALSE;
    }

    if (!$access_role) {
        $access_role = $this->CI->session->userdata('access_role');
    }

    $this->CI->load->model('user_access_map');

Thanks.

Kind Regards,

Dana +6282125686505 www.cloudbanget.com Solusi Cloud Murah dan Handal, Cuma Di CloudBanget Tempatnya.

On Jul 7, 2017, at 9:09 AM, Roni Saha notifications@github.com wrote:

Closed #27 https://github.com/xiidea/ezRbac/issues/27 via 7b1e481 https://github.com/xiidea/ezRbac/commit/7b1e481b39e8d06f6c5124af8b3cced8a81c7a80.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xiidea/ezRbac/issues/27#event-1153780446, or mute the thread https://github.com/notifications/unsubscribe-auth/AchCcMORs6Dt8i41lRP30zaH_RwG0Adsks5sLZNHgaJpZM4ONqit.

ronisaha commented 7 years ago

Your change will not work, suppose you have a controller in admin sub directory: admin/Welcome.php then your ucfirst check will leads to you to Admin/welcome.php which is not correct. My update was to save the data in lower case format. Please check with the latest code if its working or not.

ntperdana commented 7 years ago

Hi Roni,

Just tried your latest changes. It seems to work now, thanks alot for the help!

This email is sent from my mobile device. Please accept my sincere apology for any possible typos in this email.

Kind regards,

Dana Presales Manager | Presales Dvision Mobile: +6282125686505| Email: novarica.perdana@mastersystem.co.id

On Jul 7, 2017, at 17:19, Roni Saha notifications@github.com wrote:

Your change will not work, suppose you have a controller in admin sub directory: admin/Welcome.php then your ucfirst check will leads to you to Admin/welcome.php which is not correct. My update was to save the data in lower case format. Please check with the latest code if its working or not.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.