johnhamelink
5/22/2012 - 10:27 AM

group.php

        /**
         * havePermission
         *
         * Retrieves a bool value of whether the current
         * logged in user is permitted to perform a certain
         * action
         *
         * @return boolean permission
         */
        $this->addMethod('havePermission', function ($dataObject, $rights) {
                    foreach ($dataObject->getPermissions() as $objRights) {
                        if ($rights === $objRights->getName()) {
                            return true;
                        }
                    }
                    return false;
                });
    }