src/Pyrite/ACL.php
public static function can($action, $objectType = null, $objectId = null)
    {
        if (!isset($_SESSION['ACL_INFO'])) {
            return false;
        };
        $acl = $_SESSION['ACL_INFO'];

        foreach (array('*', $action) as $act) {
            if (array_key_exists($act, $acl)) {
                $acl2 = $acl[$act];
                foreach (array('*', $objectType) as $typ) {
                    if (array_key_exists($typ, $acl2)) {
                        $acl3 = $acl2[$typ];
                        if (in_array(0, $acl3) || in_array($objectId, $acl3)) {
                            return true;
                        };
                    };
                };
            };
        };

        return false;
    }
public static function can($action, $objectType = null, $objectId = null)
    {
        if (!isset($_SESSION['ACL_INFO'])) {
            return false;
        };
        $acl = $_SESSION['ACL_INFO'];

        foreach (array('*', $action) as $act) {
            if (array_key_exists($act, $acl)) {
                $acl2 = $acl[$act];
                foreach (array('*', $objectType) as $typ) {
                    if (array_key_exists($typ, $acl2)) {
                        $acl3 = $acl2[$typ];
                        if (in_array(0, $acl3) || in_array($objectId, $acl3)) {
                            return true;
                        };
                    };
                };
            };
        };

        return false;
    }
public static function can ( $ action , $ objectType = null , $ objectId = null ) { if ( ! isset ( $ _SESSION [ 'ACL_INFO' ] ) ) { return false ; } ; $ acl = $ _SESSION [ 'ACL_INFO' ] ; foreach ( array ( '*' , $ action ) as $ act ) { if ( array_key_exists ( $ act , $ acl ) ) { $ acl2 = $ acl [ $ act ] ; foreach ( array ( '*' , $ objectType ) as $ typ ) { if ( array_key_exists ( $ typ , $ acl2 ) ) { $ acl3 = $ acl2 [ $ typ ] ; if ( in_array ( 0 , $ acl3 ) || in_array ( $ objectId , $ acl3 ) ) { return true ; } ; } ; } ; } ; } ; return false ; }
Test whether current user is allowed an action

An action is defined as the triplet: action, objectType, objectId.  At
least an action must be specified.  If no objectType is specified, the
right to all objectTypes for the action is required to succeed.
Similarly, if an objectType but no objectId is specified, the right to
all objects of that type is required to succeed.

@param string $action     Action to test
@param string $objectType Class of object this applies to
@param string $objectId   Specific instance to be acted upon

@return bool Whether the action is allowed
Test whether current user is allowed an action