Reputation: 11808
I'm writing a web app, and I'd like to use repoze.what
& repoze.who
to handle my authorisation & authentication. The problem is that repoze.what
seems to be hard-coded to accept a certain permissions model, that is:
So, for example, your permissions might be 'can-post-article' and 'can-post-comment', and your groups might be 'author', 'visitor', where 'author' can both post articles & post comments, while visitors can only post comments.
That model probably works for most sites. However, my site allows teams to collaborate with each other on different levels. So the security model that I need is:
The number of groups will change over time, and the memberships of those groups will also change. I can't see any easy way to integrate this permissions model into repoze.what
. Am I missing something obvious?
Upvotes: 0
Views: 236
Reputation: 11808
I have an answer, after a bit of fiddling.
The answer is that the only reason to use the authentication schema suggested in the repoze.what documentation is that if you do, you can use their predicates for free. Fortunately, writing & using your own predicates is a piece of cake. It seems to me that the only hard requirement is for a user object (although obviously you can call this whatever you want). In my app I have a bunch of custom predicates that check certain things like:
I can then use these predicates wherever I want.
Upvotes: 0
Reputation: 172309
Well, you could easily just have a "Group_A_commenter" group and "Group_B_editor" group. They don't have to be manually generated. :) Your model is really just a matter of grouping the groups.
But you should also be able to make Predicate checkers that implement your rules.
http://what.repoze.org/docs/1.0/Manual/Predicates/index.html#term-predicate
Upvotes: 2