src/Slashworks/AppBundle/Controller/AppController.php
public function check4Client($iCustomerId)
        {

            if ($this->get('security.context')->isGranted('ROLE_ADMIN')) {
                return true;
            } else {
                $oUser = $this->getUser();
                if (empty($oUser)) {
                    return false;
                }

                $oResult = UserCustomerRelationQuery::create()->findOneByArray(array("UserId" => $oUser->getId(), "CustomerId" => $iCustomerId));

                return (!empty($oResult));
            }

        }
public function check4Client($iCustomerId)
        {

            if ($this->get('security.context')->isGranted('ROLE_ADMIN')) {
                return true;
            } else {
                $oUser = $this->getUser();
                if (empty($oUser)) {
                    return false;
                }

                $oResult = UserCustomerRelationQuery::create()->findOneByArray(array("UserId" => $oUser->getId(), "CustomerId" => $iCustomerId));

                return (!empty($oResult));
            }

        }
public function check4Client ( $ iCustomerId ) { if ( $ this -> get ( 'security.context' ) -> isGranted ( 'ROLE_ADMIN' ) ) { return true ; } else { $ oUser = $ this -> getUser ( ) ; if ( empty ( $ oUser ) ) { return false ; } $ oResult = UserCustomerRelationQuery :: create ( ) -> findOneByArray ( array ( "UserId" => $ oUser -> getId ( ) , "CustomerId" => $ iCustomerId ) ) ; return ( ! empty ( $ oResult ) ) ; } }
Check if user has access to customer

@param int $iCustomerId

@return bool
Check if user has access to customer