Symfony: как проверить, предоставлен ли другой контроллерPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Symfony: как проверить, предоставлен ли другой контроллер

Сообщение Anonymous »


e.g. I have a Show action for my Categories, and there is an "actions" property I want to provide the frontend with the list of actions that the current logged in user can do on this entity (e.g. ["edit", "delete"]).

In the backend I want to simply give a list of Controllers (since I use __invoke, just passing the class name should be enough: e.g. ["edit" => CategoryEditController::class, "delete" => CategoryDeleteController::class]) to a function which tells me whether that controller is accessible for the user or not (e.g. ["edit" => true, "delete" => false])

I haven't figured out yet how I can check another class's IsGranted which is the crucial issue I'm facing. Does anyone have an idea?

Also need to consider, IsGranted could not just be a string but an expression and also contain a subject.


Источник: https://stackoverflow.com/questions/781 ... is-granted
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»