PHP code example of noraziz / ci4-aauth

1. Go to this page and download the library: Download noraziz/ci4-aauth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

noraziz / ci4-aauth example snippets


$this->load->library("Aauth");

$this->aauth->create_user('[email protected]','frodopass','FrodoBaggins');
$this->aauth->create_user('[email protected]','legolaspass','Legolas');

$this->aauth->create_group('hobbits');
$this->aauth->create_group('elves');

$this->aauth->create_user('[email protected]', 'gandalfpass', 'GandalfTheGray');

$this->aauth->create_perm('walk_unseen');
$this->aauth->create_perm('immortality');

$this->aauth->allow_group('hobbits','walk_unseen');
$this->aauth->allow_group('elves','immortality');
  
  
$this->aauth->allow_group('hobbits','immortality');

$this->aauth->deny_group('hobbits','immortality');

$this->aauth->allow_user(12,'immortality');

if($this->aauth->is_group_allowed('hobbits','immortality')){
	echo "Hobbits are immortal";
} else {
	echo "Hobbits are NOT immortal";
}

if($this->aauth->is_allowed(12,'immortality')){
	echo "Gandalf is immortal";
} else {
	echo "Gandalf is NOT immortal";
}

$this->aauth->delete_perm('immortality');

$this->aauth->allow_group('public','travel');

$this->aauth->set_user_var("key","value");

$this->aauth->set_user_var("phone","1-507-555-1234");

$this->aauth->get_user_var("key");

$this->aauth->set_system_var("key","value");
$this->aauth->get_system_var("key");

$this->aauth->send_pm(3,4,'New cloaks','These new cloaks are fantastic!')

$this->aauth->ban_user(3);