I have a function that checks if a user has access to a repository.
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;
}
The Call
/* Get Client */
$client = $em->getRepository('AppBundle:Client')->find($request->get('clientId'));
/* Get ACL */
$this->get('global_functions')->getACL($client, 'VIEW');
What I'd like to get
I would like to see the name of the repository the user has been denied to, like this:
$this->get('log')->writeLog('Access denied to $REPOSITORYNAME.', __LINE__, 3);
in this case $REPOSITORYNAME should be AppBundle:Client or even only Client
Is that at all possible? is there a way t
May be so
$this->get('log')->writeLog('Access denied to '.get_class($repository).'.', __LINE__, 3);
or
$class = get_class($repository);
$this->get('log')->writeLog('Access denied to '.substr($class, strrpos($class, '\\') + 1).'.', __LINE__, 3);
or I didn't understand question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With