Add a getDescription() : string method to Policy class. It should return a human-readable description of the policy.
For example, new Policies.LoggedIn().getDescription() could return "This is allowed only for users who are logged in."
This also need to handle cases where we build more complex policies out of simpler ones. So for example new Policies.Not(new Policies.LoggedIn()).getDescription() should return "This is forbidden for users who are logged in".
In order to achieve this modularity, it's best to have two additional methods:
- getPartialPositiveDescription() that only answers the question "why can you access this? Because..." - for LoggedIn, it should return "you are logged in".
- getPartialNegativeDescription() that only answers the question "why are you forbidden from accessin this? Because..." - for LoggedIn, it should return "you are not logged in".