Welcome Guest, Not a member yet? Register   Sign In
Community Auth require_role
#1

The require_role method doesn't seem to be working for me.  It logins in someone with admin role but it doesn't give access to the managers role. 

in controller
PHP Code:
public function reg_users()
    {
        if( 
$this->require_role('admin,managers') )
        { 
I also tried to use the require_min_level(6) instead of the require_role() method but it doesn't work either it just lets in the admin role.  I've also tried require_role('managers') and no go there either.

in authentication.php

PHP Code:
$config['levels_and_roles'] = array(
    
"1" => "noaccess",
    
"6" => "managers",
    
"9" => "admin"
); 

I'm not sure whats going on.
Reply
#2

Figured it out, never mind.
Reply
#3

(04-04-2017, 07:36 PM)deadlock0071 Wrote: Figured it out, never mind.

What was it?
Reply
#4

Just a brain fart moment... I was messing around with an if statement in the controller and it also called the require_role() method. So it was basically if require_role() with another if require_role() inside of that.  I stared at that thing for the longest time and just didn't see it. Ate dinner came back, looked at it and shook my head.

Thanks for the reply.
Reply
#5

(04-05-2017, 08:47 AM)deadlock0071 Wrote: Just a brain fart moment... I was messing around with an if statement in the controller and it also called the require_role() method. So it was basically if require_role() with another if require_role() inside of that.  I stared at that thing for the longest time and just didn't see it. Ate dinner came back, looked at it and shook my head.

Thanks for the reply.

Numerous times I've been completely perplexed by a problem, spent hours on it, then had to walk away, only to come back after sleeping or taking a break and figuring it out in 5 minutes. I should just take more breaks, but it's hard when I feel like I need to get things done.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB