PHP Classes

File: examples/login/application/helpers/AccessCheck.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/login/application/helpers/AccessCheck.php   Download  
File: examples/login/application/helpers/AccessCheck.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 621 bytes
 

Contents

Class file image Download
<?php
class AccessCheck {

    protected
$user;
    function
__construct($user) {
        
$this->user = $user;
    }

    function
run($controller) {
        
// now rule objects are only created if denyAccess() exists
        
$isloggedin = new A_User_Rule_Isloggedin();
        
$ingroup = new A_User_Rule_Ingroup('admin');
        
// check if access check fails
        
if(! $isloggedin->isValid($this->user) && ! $ingroup->isValid($this->user)) {
             
// if access check fails then return DL so Front Controller
              // will forward to 'login' instead of requested Action
             
return array('', 'login', 'index');
         }
    }
}