What will be the best practice to implement in phalcon, rules related to save/fetch data from models, based on status, type user, for example, in the system we have 3 type of the users:
And in the system we have Model (Houses), with column status with options (new,ready,process,checked,finish,archive)
And i want to make rules, for example:
- update House, can be made by User only if House is in state, new,ready and process
- Public can update only fields name and address in House model
- User can update all fields, except field admin_check
So, question is how to implement good solution, to make that kind of business rules, on model level.
Same problem with forms, different users in different states have different forms, for example:
- Public user in state new, see only fields address, name
- User in state new, and ready, see also fields to upload documents)
- Admin in all state see full form to update everything
WHat will be best aproach to make that kind of rules, related to forms.