PHP code example of colbeh / access

1. Go to this page and download the library: Download colbeh/access 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/ */

    

colbeh / access example snippets


    if(Access::hasPermission('root')){
    
        // access granted
      
    }else{
    
        // access denied
    }
    

    * getAdmin ($id)
    * getRole ($id)
    
    * roleStore ($name,$desc,$permissionIds)
    * roleUpdate ($roleId,$name,$desc,$permissionIds=null)
    * roleToggle ($adminId,$permissionId)  // toggle a role to admin
    * roleAttach ($adminId,$permissionId)  // add a role to admin
    * roleDetach ($adminId,$permissionId)  // remove a role from admin
    * rolesList()
    
    * permissionToggle ($roleId,$permissionId)  // toggle a permission to role
    * permissionAttach ($roleId,$permissionId)  // add a permission to role
    * permissionDetach ($roleId,$permissionId)  // remove a permission from role
    * permissionsList ($roleId=null)