Controller/ProfileController.php
private function showAndEdit( Request $request, $action )
    {
        $user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
                     ->findOneByUsernameSlug( $request->get( 'username_slug' ));
        if ( $user )
        {
            $currentUser = $this->get( 'security.context' )->getToken()->getUser();
            if (
                    self::SHOW == $action
                    || $currentUser->getId() == $user->getId()
                    || $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' )
            )
            {
                return $this->render( 'UserfriendlySocialUserBundle:Profile:' . $action . '.html.twig', array(
                    'user' => $user,
                ));
            }
            throw new AccessDeniedException();
        }
        throw new NotFoundHttpException();
    }
private function showAndEdit( Request $request, $action )
    {
        $user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
                     ->findOneByUsernameSlug( $request->get( 'username_slug' ));
        if ( $user )
        {
            $currentUser = $this->get( 'security.context' )->getToken()->getUser();
            if (
                    self::SHOW == $action
                    || $currentUser->getId() == $user->getId()
                    || $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' )
            )
            {
                return $this->render( 'UserfriendlySocialUserBundle:Profile:' . $action . '.html.twig', array(
                    'user' => $user,
                ));
            }
            throw new AccessDeniedException();
        }
        throw new NotFoundHttpException();
    }
private function showAndEdit ( Request $ request , $ action ) { $ user = $ this -> get ( 'userfriendly_social_user.oauth_user_provider' ) -> findOneByUsernameSlug ( $ request -> get ( 'username_slug' ) ) ; if ( $ user ) { $ currentUser = $ this -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; if ( self :: SHOW == $ action || $ currentUser -> getId ( ) == $ user -> getId ( ) || $ this -> get ( 'security.context' ) -> isGranted ( 'ROLE_ADMIN' ) ) { return $ this -> render ( 'UserfriendlySocialUserBundle:Profile:' . $ action . '.html.twig' , array ( 'user' => $ user , ) ) ; } throw new AccessDeniedException ( ) ; } throw new NotFoundHttpException ( ) ; }
Private methods for use in this Controller's public methods
Private methods for use in this Controller s public methods