fastapi-permissions
fastapi-permissions copied to clipboard
Polymorphic principals
Firstly, thanks so much for your work on this project!
Just a feature request: that principals are not expected to have a specific type (currently, they are typed as str
), but could instead be represented by an object of any type.
I would also suggest that we supply the default principals as namedtuples instead of colon-delimited strings, separating the semantics of the method (e.g. the role, user, etc.) from the values (e.g. create, read, update, delete,). Flask-Principal currently does this, making for a nicer user interface, in my opinion. They even supply partially-filled namedtuple principals for common methods: id, role, type, action.
Of course, since we're generalising the type of the principal, those wanting to use the string-based approach could still do so, with the default implementation being just a suggestion.