3
私は、ユーザがリポジトリにアクセスできるかどうかをチェックする機能を持っています。symfonyのリポジトリ名の取得
public function getACL($repository, $granted){
if (false === $this->authorizationChecker->isGranted($granted, $repository)) {
$this->get('log')->writeLog('Access denied.', __LINE__, 3);
return new JsonResponse(array(
'result' => 'error',
'message' => 'Not allowed'
));
}
return true;
}
コール
/* Get Client */
$client = $em->getRepository('AppBundle:Client')->find($request->get('clientId'));
/* Get ACL */
$this->get('global_functions')->getACL($client, 'VIEW');
私は
を取得したいのですが私はこのように、ユーザが拒否されたリポジトリの名前を見てみたいです:
$this->get('log')->writeLog('Access denied to $REPOSITORYNAME.', __LINE__, 3);
この場合の
$REPOSITORYNAME
は、
AppBundle:Client
またはさらには
Client
である必要がありますか? であってもよい
まず、あなたがここにリポジトリを扱っていない問題を理解していませんでしたそれはリポジトリから取得された 'Client'(エンティティ)のインスタンスです。 'get_class()'関数もチェックしてください。 –