The problem that I see when assigning a role based on what the user does / has is that it hardcodes the rules in your code. Implicit rule in your example:
deny user access when user has property/behavior X
The way to see this is hard-coded to ask yourself what happens if you want to adjust it. Suppose you find the suspicious behavior is too strict and want to endure more, then you have to go to the .php file and change it.
I think it's best to look at the rule statement part:
http://framework.zend.com/manual/en/zend.acl.advanced.html
Depending on your specific needs, this may be a good solution.
edit: reply to comment → I appreciate what you do. I think this indicates why RBAC will be replaced by more powerful access controls, such as attribute-based access control. This will allow rules based on user attributes and objects / resources under control. Ideally, you want access control to have as much logic as possible in deciding on permissions. When you assign roles to users implicitly, some of the solutions will be outside of access control (for example, which user will be the administrator, mainly determined by things like whoever owns the website). But you want to minimize decision making outside of acl because it adds an access level that is not controlled by acl. Thus, the decision of who will have a role is often implied outside of acl. But still this is access control, defined by some logic, and it is best to keep so much logic inside the program that is responsible for processing this domain. Hope this mess makes sense :-)
source share