|
Now, @roles_required and @permission_required let sb. pass when any ONE role or any ONE permission satisfy. def roles_required(*roles: str, *, operator : or|and = or) -> Callable: |
Replies: 2 comments
|
This is an excellent idea, and thank you for pointing out the inconsistency! I've just added a To ensure backward compatibility:
You can now explicitly override this behavior whenever you need: # User must have BOTH admin AND editor roles
@roles_required("admin", "editor", require_all=True)
# User must have ANY of the permissions (read OR write)
@permission_required("read", "write", require_all=False)Additionally, while reviewing the code for this, I noticed that both of these decorators previously failed to support These improvements have been committed to the |
|
By the way, you have some really great ideas for the framework! Next time you spot an inconsistency like this or have a feature idea, we would absolutely love to invite you to open a Pull Request (PR) directly. We really appreciate community contributions, and it would be awesome to have you formally contribute to the codebase! Thanks again for helping improve BustAPI! 🚀 |
This is an excellent idea, and thank you for pointing out the inconsistency!
I've just added a
require_allflag to both@roles_requiredand@permission_required.To ensure backward compatibility:
@roles_requiredstill defaults torequire_all=False(OR logic).@permission_requiredstill defaults torequire_all=True(AND logic).You can now explicitly override this behavior whenever you need:
Additionally, while reviewing the code for this, I noticed that both of these decorators …