File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -659,9 +659,8 @@ def identifier(self) -> str:
659659 def __eq__ (self , other : "PermissionData" ) -> bool :
660660 """Compare permissions based on their action identifier.
661661
662- Two permissions are considered equal if they have the same action,
663- regardless of the effect. This allows checking if a role grants a
664- specific action using the 'in' operator.
662+ Two PermissionData instances are considered equal if they have the same action's
663+ external_key and effect.
665664
666665 Args:
667666 other: Another PermissionData instance or any object.
@@ -671,8 +670,8 @@ def __eq__(self, other: "PermissionData") -> bool:
671670
672671 Example:
673672 >>> perm1 = PermissionData(action=ActionData(external_key='view'), effect='allow')
674- >>> perm2 = PermissionData(action=ActionData(external_key='view'), effect='deny ')
675- >>> perm1 == perm2 # True - same action TODO: should we also consider the effect?
673+ >>> perm2 = PermissionData(action=ActionData(external_key='view'), effect='allow ')
674+ >>> perm1 == perm2 # True - same action and effect
676675 True
677676 >>> perm1 in [perm2] # Uses __eq__
678677 True
You can’t perform that action at this time.
0 commit comments