Welcome Guest, Not a member yet? Register   Sign In
About IonAuth 4 auth System
#4

(11-09-2019, 02:08 PM)Poetawd Wrote: I believe that you are making some confusion...

Try to keep it simple...

Just load the library in method and BE HAPPY ! Ion Auth is meant to be simple...  Big Grin

PHP Code:
    public function addNewRecord()
    {

        //Loads the Authentication Library: ION AUTH
        $ionAuth = new \IonAuth\Libraries\IonAuth();

        //Checks if the user is Logged In
        if(!$ionAuth->loggedIn()){

          die;  

        
}
    

But suppose you have logged in and that you want to send a message notifying the user that he does not have access to certain system functionality.

Inicio Controller:

PHP Code:
public function ErrorDeAcceso(){
 
 
$mostrar["error"] = "ACCESO DENEGADO, SOLICITE AYUDA A UN ADMINISTRADOR.";
 
$mostrar["contenido"] = "vista_acceso_denegado";
 return 
view("plantilla"$mostrar);
 
    

Usuarios Controller:
PHP Code:
public function VerSiUsuarioTieneAccesoAlaOpcion($id_modulo_opcion){
 
//esta funcion verifica si el usuario tiene permsios para acceder a la accion recibe como paramentro el id_modulo_opcion si el usuario no tiene permissos le redirige a una vista con un msj que no tiene acceso a tal proceso
 
if (!in_array("$id_modulo_opcion"$this->la_sesion->ids_modulo_opciones)) {
 
 
////base_url()."Inicio/ErrorDeAcceso";
 
return redirect()->to(base_url()."/Inicio/ErrorDeAcceso/");
 exit;
 }
 }
public function 
ListaUsuarios(){
 
//verifico si el usuario tiene permisos a esta opcion enviando el id_modulo_opcion que es unica
 
$this->VerSiUsuarioTieneAccesoAlaOpcion(700);
 
$mostrar["ListaUarios"] = $this->Usuariosbuscar->ListaUarios();
 
$mostrar["contenido"] = "usuarios/vista_usuarios";
 return 
view('plantilla'$mostrar);
 } 

When invoking
PHP Code:
$this->VerSiUsuarioTieneAccesoAlaOpcion(700); 

I did not redirect myself to the respective controller, but it continues to execute what follows after
PHP Code:
$this->VerSiUsuarioTieneAccesoAlaOpcion(700); 

something wrong?
Reply


Messages In This Thread
About IonAuth 4 auth System - by adelbak - 11-02-2019, 10:00 PM
RE: About IonAuth 4 auth System - by Poetawd - 11-09-2019, 02:08 PM
RE: About IonAuth 4 auth System - by macruzgi - 11-13-2019, 10:55 AM
RE: About IonAuth 4 auth System - by XTAZ - 11-12-2019, 01:16 PM
RE: About IonAuth 4 auth System - by cseon - 11-27-2019, 12:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB