What's the best way to allow the user to edit his content?

Hello guys. I did my ACL and Auth Middleware and ran into a problem. I whant to allow the user to edit his content. But how will it be correct to obtain information that this content is the user's content?

For example, I get the userId from the Session in Middleware and transfer it to my Acl to check the access.

Next, I want to transfer it to the controller's action... And how can I do it right (transfer user data to controller)? How can I make a universal check whether the content belongs to the user?

Thanks in advance!

edited Feb '19

Thanks for your answer. I'm sorry, but is it the optimal Phalcon-solution? Are you seriously?

I did not mean the code on Zephir -- only the php-code applicable in conjunction with the Phalcon. A bunch of Middleware, Acl and Controller, I mean.

edited Feb '19

All right then :)

I can easily complete my task, but I understand that my decision will not well. And how can I do it correctly?

For example, how to correctly transfer data from the (auth) middleware to controller?

Anyway, thanks for the reply!

Go to this website and analyze the company's projects. These guys create programs for various tasks, including content editing. Did you solve this problem or not?