public function assign($userId, $name)
    {
        if ($this->searchRoleRecursive($this->roles, $name)) {
            $exists = $this->db->exists('rbac_user', ['user' => $userId, 'role' => $name]);
            if (!$exists) {
                return $this->db->insert('rbac_user', ['role' => $name, 'user' => $userId]);
            }
        }

        return false;
    }
public function assign($userId, $name)
    {
        if ($this->searchRoleRecursive($this->roles, $name)) {
            $exists = $this->db->exists('rbac_user', ['user' => $userId, 'role' => $name]);
            if (!$exists) {
                return $this->db->insert('rbac_user', ['role' => $name, 'user' => $userId]);
            }
        }

        return false;
    }
public function assign ( $ userId , $ name ) { if ( $ this -> searchRoleRecursive ( $ this -> roles , $ name ) ) { $ exists = $ this -> db -> exists ( 'rbac_user' , [ 'user' => $ userId , 'role' => $ name ] ) ; if ( ! $ exists ) { return $ this -> db -> insert ( 'rbac_user' , [ 'role' => $ name , 'user' => $ userId ] ) ; } } return false ; }
Assign RBAC element into user

@access public

@param integer $userId user id
@param string $name element name

@return bool
Assign RBAC element into user