Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 20
    This would be a lot clearer if you lower-cased your object names. Commented Feb 8, 2015 at 18:49
  • 38
    Good example of the specification; bad example of inheritance. To anyone else reading this, please, don't try to solve user roles using inheritance. Commented Feb 8, 2015 at 19:01
  • 8
    @Aaronaught is correct. Don't create separate classes for different types of people. Use a bitfield enum. Commented Feb 8, 2015 at 19:42
  • 1
    @Aaronaught It's all very well saying what not to do, but it's not very helpful without saying what people should do instead. Commented Feb 8, 2015 at 23:45
  • 5
    @Pharap: I have done exactly that, in several other questions. The simple answer is that users (authentication/identity) and security policy (authorization/permissions) should be treated as separate concerns, and the standard models for security policy are either role-based or claims-based. Inheritance is more useful to describe the object that actually does the authentication, e.g. an LDAP implementation and a SQL implementation. Commented Feb 9, 2015 at 2:44