I've read several articles about authorisation handling in rest api + single page applications. They mostly suggest following: When front end app is initialised, retrieve user roles and check roles in client side and apply logic based on it, show/hide particular controls based on roles, etc.
But I didn't find any article about more complex authorisation logic.
For example: there is rest api with Role Based Access Control (I'm using Yii2 rbac). There is front end app (I'm using angular). In this app, list of posts are listed. So based on user role, "Edit" button should be visible/hidden for each post in this list appropriately.
There are roles:
Admin
User - logged in user
Guest
Problem is, "edit" permission for user which has "User" role depends on context (business rule) - if user is author of post, he allowed to edit post, elsewhere it is forbidden.
So what is best practice to handle such type of authorisation in front end part of application?
Provide permissions for operations for each entity in response when user performs call to rest endpoint?